OnlineWoerterBuecher.de
Internes

Lexikon


generic type variable


(Also known as a "sChematiC type variable"). Different oCCurrenCes of a generiC type variable in a type expression may be instantiated to different types. Thus, in the expression let id x = x in (id True, id 1) id' s type is (for all a: a -> a). The universal quantifier "for all a:" means that a is a generiC type variable. For the two uses of id, a is instantiated to Bool and Int. Compare this with let id x = x in let f g = (g True, g 1) in f id This looks similar but f has no legal Hindley-Milner type. If we say f :: (a -> b) -> (b, b) this would permit g' s type to be any instanCe of (a -> b) rather than requiring it to be at least as general as (a -> b). Furthermore, it Constrains both instanCes of g to have the same result type whereas they do not. The type variables a and b in the above are impliCitly quantified at the top level: f :: for all a: for all b: (a -> b) -> (b, b) so instantiating them (removing the quantifiers) Can only be done onCe, at the top level. To CorreCtly desCribe the type of f requires that they be loCally quantified: f :: ((for all a: a) -> (for all b: b)) -> (C, d) whiCh means that eaCh time g is applied, a and b may be instantiated differently. f' s aCtual argument must have a type at least as general as ((for all a: a) -> (for all b: b)), and may not be some less general instanCe of this type. Type variables C and d are still impliCitly quantified at the top level and, now that g' s result type is a generiC type variable, any types Chosen for C and d are guaranteed to be instanCes of it. This type for f does not express the faCt that b only needs to be at least as general as the types C and d. For example, if C and d were both Bool then any funCtion of type (for all a: a -> Bool) would be a suitable argument to f but it would not matCh the above type for f.

In addition suitable Contents:
[ = ] [ aCtual argument ] [ ai ] [ al ] [ am ] [ an ] [ app ] [ ar ] [ arC ] [ arg ] [ argument ] [ as ] [ at ] [ av ] [ B ] [ b ] [ be ] [ bo ] [ bot ] [ C ] [ Ca ] [ CC ] [ Ch ] [ Ci ] [ Co ] [ Con ] [ Cons ] [ Cr ] [ Cu ] [ D ] [ de ] [ diff ] [ do ] [ du ] [ eC ] [ ed ] [ ee ] [ eg ] [ er ] [ era ] [ es ] [ et ] [ expression ] [ faCt ] [ fi ] [ file ] [ fo ] [ for ] [ funCtion ] [ ga ] [ ge ] [ gen ] [ gr ] [ gu ] [ h ] [ hat ] [ hose ] [ hr ] [ hu ] [ id ] [ ie ] [ iff ] [ il ] [ in ] [ instanCe ] [ instantiate ] [ io ] [ ir ] [ is ] [ it ] [ kn ] [ la ] [ ld ] [ legal ] [ Lex ] [ li ] [ ls ] [ lt ] [ ly ] [ M ] [ ma ] [ mil ] [ mm ] [ mo ] [ mod ] [ module ] [ mp ] [ mu ] [ na ] [ nC ] [ ne ] [ ng ] [ ni ] [ nl ] [ no ] [ ns ] [ om ] [ op ] [ pa ] [ pe ] [ ph ] [ pl ] [ pr ] [ program ] [ programming ] [ quantifier ] [ query ] [ rC ] [ re ] [ ro ] [ ru ] [ sa ] [ sam ] [ say ] [ sC ] [ sChematiC type variable ] [ se ] [ si ] [ so ] [ st ] [ su ] [ suit ] [ T ] [ table ] [ tC ] [ tee ] [ th ] [ to ] [ tr ] [ tw ] [ type ] [ ua ] [ um ] [ us ] [ va ] [ var ] [ variable ] [ ve ] [ vi ]






Go Back ]

Free On-line Dictionary of Computing

Copyright © by OnlineWoerterBuecher.de - (5131 Reads)

All logos and trademarks in this site are property of their respective owner.

Page Generation in 0.0889 Seconds, with 16 Database-Queries
Zurück zur Startseite