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.

Style="border-width:thin; border-color:#333333; border-Style:daShed; padding:5px;" align="left">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 - (5144 Reads)

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

Page Generation in 0.1005 Seconds, with 17 Database-Queries
Zurück zur Startseite