From: simonpj@microsoft.com Date: Fri, 16 Nov 2007 14:58:16 +0000 (+0000) Subject: Improve links from flag reference to the relevant section; and improve doc of RankN... X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=commitdiff_plain;h=68d07cacb57fe5ee8ca75dc1942c8c728240c8cb Improve links from flag reference to the relevant section; and improve doc of RankN flags --- diff --git a/docs/users_guide/flags.xml b/docs/users_guide/flags.xml index 27c0dda..d4b6bcc 100644 --- a/docs/users_guide/flags.xml +++ b/docs/users_guide/flags.xml @@ -786,11 +786,23 @@ - Enable polymorphic components. + Enable polymorphic components for data constructors. dynamic + + Enable rank-2 types. + dynamic + + + + + Enable rank-N types. + dynamic + + + Enable existential quantification. dynamic @@ -833,18 +845,6 @@ - - Enable rank-2 types. - dynamic - - - - - Enable rank-N types. - dynamic - - - Enable type operators. dynamic @@ -864,19 +864,19 @@ - Enable record wildcards. + Enable record wildcards. dynamic - Enable record puns. + Enable record puns. dynamic - Enable the disambiguate fields. exception + Enable record field disambiguation. dynamic @@ -912,19 +912,19 @@ - Enable flexible contexts. + Enable flexible contexts. dynamic - Enable flexible instances. + Enable flexible instances. dynamic - Enable constrained class methods. + Enable constrained class methods. dynamic diff --git a/docs/users_guide/glasgow_exts.xml b/docs/users_guide/glasgow_exts.xml index a01dea4..0687646 100644 --- a/docs/users_guide/glasgow_exts.xml +++ b/docs/users_guide/glasgow_exts.xml @@ -2689,7 +2689,7 @@ class type variable, thus: The type of elem is illegal in Haskell 98, because it contains the constraint Eq a, constrains only the class type variable (in this case a). -GHC lifts this restriction. +GHC lifts this restriction (flag ). @@ -3036,7 +3036,7 @@ must be of the form C a where a is a type variable that occurs in the head. -The flag loosens these restrictions +The flag loosens these restrictions considerably. Firstly, multi-parameter type classes are permitted. Secondly, the context and head of the instance declaration can each consist of arbitrary (well-kinded) assertions (C t1 ... tn) subject only to the @@ -3442,7 +3442,7 @@ to work since it gets translated into an equality comparison. Type signatures -The context of a type signature +The context of a type signature Unlike Haskell 98, constraints in types do not have to be of the form (class type-variable) or @@ -4078,9 +4078,18 @@ The function f3 has a rank-3 type; it has rank-2 types on the left of a function arrow. -GHC allows types of arbitrary rank; you can nest foralls -arbitrarily deep in function arrows. (GHC used to be restricted to rank 2, but -that restriction has now been lifted.) +GHC has three flags to control higher-rank types: + + + : data constructors (only) can have polymorphic argment types. + + + : any function (including data constructors) can have a rank-2 type. + + + : any function (including data constructors) can have an arbitrary-rank type. +That is, you can nest foralls +arbitrarily deep in function arrows. In particular, a forall-type (also called a "type scheme"), including an operational type class context, is legal: @@ -4092,6 +4101,8 @@ field type signatures. As the type of an implicit parameter In a pattern type signature (see ) + + Of course forall becomes a keyword; you can't use forall as a type variable any more!