X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=docs%2Fusers_guide%2Fglasgow_exts.xml;h=093858bb0e5b97e2365eef37026ade090803b643;hb=e17a800817a370fd198831f12cff35122376fa8d;hp=befb416fc7dbeb418ce9b6e41ef3e6f1c12d6d4a;hpb=7defebee53964996947d1dee2c6606519d796429;p=ghc-hetmet.git diff --git a/docs/users_guide/glasgow_exts.xml b/docs/users_guide/glasgow_exts.xml index befb416..093858b 100644 --- a/docs/users_guide/glasgow_exts.xml +++ b/docs/users_guide/glasgow_exts.xml @@ -78,6 +78,7 @@ documentation describes all the libraries that come with GHC. , , , + , , , , @@ -1664,7 +1665,8 @@ The following syntax is stolen: forall - Stolen (in types) by: , + Stolen (in types) by: , and hence by + , , , , @@ -4713,10 +4715,30 @@ might be in another module, or even in a module that is not yet written. Other type system extensions - -Type signatures +Explicit universal quantification (forall) + +Haskell type signatures are implicitly quantified. When the language option +is used, the keyword forall +allows us to say exactly what this means. For example: + + + + g :: b -> b + +means this: + + g :: forall b. (b -> b) + +The two are treated identically. + + +Of course forall becomes a keyword; you can't use forall as +a type variable any more! + + + -The context of a type signature +The context of a type signature The flag lifts the Haskell 98 restriction that the type-class constraints in a type signature must have the @@ -4745,7 +4767,7 @@ Consider the type: language omits them; in Haskell 98, all the free type variables of an explicit source-language type signature are universally quantified, except for the class type variables in a class declaration. However, -in GHC, you can give the foralls if you want. See ). +in GHC, you can give the foralls if you want. See ). @@ -4833,9 +4855,6 @@ territory free in case we need it later. - - - @@ -5313,22 +5332,7 @@ The parentheses are required. -Haskell type signatures are implicitly quantified. The new keyword forall -allows us to say exactly what this means. For example: - - - - g :: b -> b - -means this: - - g :: forall b. (b -> b) - -The two are treated identically. - - - -However, GHC's type system supports arbitrary-rank +GHC's type system supports arbitrary-rank explicit universal quantification in types. For example, all the following types are legal: @@ -5383,8 +5387,6 @@ field type signatures. -Of course forall becomes a keyword; you can't use forall as -a type variable any more!