From: simonpj Date: Thu, 24 Jul 2003 07:45:09 +0000 (+0000) Subject: [project @ 2003-07-24 07:45:09 by simonpj] X-Git-Tag: Approx_11550_changesets_converted~643 X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=commitdiff_plain;h=72f5cd2fbc56c266e92f974a4561fbe878628b63 [project @ 2003-07-24 07:45:09 by simonpj] Document deriving(Typeable,Data) --- diff --git a/ghc/docs/users_guide/glasgow_exts.sgml b/ghc/docs/users_guide/glasgow_exts.sgml index c41e999..9306e08 100644 --- a/ghc/docs/users_guide/glasgow_exts.sgml +++ b/ghc/docs/users_guide/glasgow_exts.sgml @@ -2980,6 +2980,25 @@ Result type signatures are not yet implemented in Hugs. + +Deriving clause for classes <literal>Typeable</literal> and <literal>Data</literal> + + +Haskell 98 allows the programmer to add "deriving( Eq, Ord )" to a data type +declaration, to generate a standard instance declaration for classes specified in the deriving clause. +In Haskell 98, the only classes that may appear in the deriving clause are the standard +classes Eq, Ord, +Enum, Ix, Bounded, Read, and Show. + + +GHC extends this list with two more classes that may be automatically derived +(provided the flag is specified): +Typeable, and Data. These classes are defined in the library +modules Data.Dynamic and Data.Generics respectively, and the +appropriate class must be in scope before it can be mentioned in the deriving clause. + + + Generalised derived instances for newtypes