From 72f5cd2fbc56c266e92f974a4561fbe878628b63 Mon Sep 17 00:00:00 2001 From: simonpj Date: Thu, 24 Jul 2003 07:45:09 +0000 Subject: [PATCH] [project @ 2003-07-24 07:45:09 by simonpj] Document deriving(Typeable,Data) --- ghc/docs/users_guide/glasgow_exts.sgml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) 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 -- 1.7.10.4