Mutually recursive modules and derived instances of Data

Carsten Schultz carsten at
Wed Oct 13 09:30:38 EDT 2004

Hi Simon!

On Wed, Oct 13, 2004 at 01:21:26PM +0100, Simon Peyton-Jones wrote:
> Two fixes suggest themselves
> 1.  Separate 'deriving' from the data type decl, so you can say
> 	derive( Data TA, Typeable TA )
> anywhere.  People sometimes ask for this for other reasons.  

Good thing.  Plus, allow to hook in Template Haskell at some point, so

import DeriveMyClass

derive(MyClass TA)

is equivalent to

import DeriveMyClass

$( deriveMyClass (reifyDecl TA) )

(or whatever the TH-syntax will be at that point :-)  Then 

data TA = ...
    deriving (MyClass)

should also be possible.  The advantage would be that only the module
defining the deriving would have to know about TH, not the one using
it.  On other systems, the deriving could then be realized via a
pre-processor or similar means.



Carsten Schultz (2:38, 33:47), FB Mathematik, FU Berlin
PGP/GPG key on the key servers, 
fingerprint on my home page.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url :

More information about the Glasgow-haskell-users mailing list