Stand-alone deriving declarations added
Bjorn Bringert
bringert at cs.chalmers.se
Thu Oct 5 04:05:00 EDT 2006
Hi all,
I have just pushed some patches which add support for stand-alone
'deriving' declarations. The main motivation for this is to allow you
to use the instance deriving mechanism for data types and newtypes
declared in other modules, for example if you want to use generics
with existing code that does not derive Typeable and Data, or want to
use Show for debugging.
The syntax is:
deriving Class for Type
and for multi-parameter type classes:
deriving (Class t1 ... tn) for Type
You can't derive multiple classes in a single deriving declaration,
but you can have multiple deriving declarations for the same type.
I have added a small section to the type system extensions part of
the Users' Guide, and a number of test cases.
This is a direct result of the GHC hackathon.
/Björn
More information about the Cvs-ghc
mailing list