X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=docs%2Fusers_guide%2Fglasgow_exts.xml;h=9ea3332463d109f0aa2f22a185701c66147837d0;hb=6cec61d14a324285dbb8ce73d4c7215f1f8d6766;hp=a1930880d6658114bc66414204c77663ed43fc14;hpb=da43a382ccc7d3c57068976c312dc583fddc7498;p=ghc-hetmet.git diff --git a/docs/users_guide/glasgow_exts.xml b/docs/users_guide/glasgow_exts.xml index a193088..9ea3332 100644 --- a/docs/users_guide/glasgow_exts.xml +++ b/docs/users_guide/glasgow_exts.xml @@ -2434,7 +2434,8 @@ declarations. Define your own instances! Declaring data types with explicit constructor signatures -GHC allows you to declare an algebraic data type by +When the GADTSyntax extension is enabled, +GHC allows you to declare an algebraic data type by giving the type signatures of constructors explicitly. For example: data Maybe a where @@ -5725,9 +5726,6 @@ for rank-2 types. Impredicative polymorphism -NOTE: the impredicative-polymorphism feature is deprecated in GHC 6.12, and -will be removed or replaced in GHC 6.14. - GHC supports impredicative polymorphism, enabled with . This means @@ -5850,7 +5848,7 @@ signature is explicit. For example: g (x:xs) = xs ++ [ x :: a ] This program will be rejected, because "a" does not scope -over the definition of "f", so "x::a" +over the definition of "g", so "x::a" means "x::forall a. a" by Haskell's usual implicit quantification rules. @@ -5886,7 +5884,7 @@ type variables, in the annotated expression. For example: f = runST ( (op >>= \(x :: STRef s Int) -> g x) :: forall s. ST s Bool ) -Here, the type signature forall a. ST s Bool brings the +Here, the type signature forall s. ST s Bool brings the type variable s into scope, in the annotated expression (op >>= \(x :: STRef s Int) -> g x). @@ -8919,7 +8917,7 @@ An example will give the idea: - import Generics + import Data.Generics class Bin a where toBin :: a -> [Int] @@ -8939,7 +8937,7 @@ An example will give the idea: This class declaration explains how toBin and fromBin work for arbitrary data types. They do so by giving cases for unit, product, and sum, -which are defined thus in the library module Generics: +which are defined thus in the library module Data.Generics: data Unit = Unit @@ -8961,14 +8959,16 @@ where clause and over-ride whichever methods you please. To use generics you need to - Use the flags (to enable the extra syntax), - (to generate extra per-data-type code), - and (to make the Generics library - available. + + Use the flags (to enable the + extra syntax and generate extra per-data-type code), + and (to make the + Data.Generics module available. + - Import the module Generics from the - lang package. This import brings into + Import the module Data.Generics from the + syb package. This import brings into scope the data types Unit, :*:, and :+:. (You don't need this import if you don't mention these types