deriving...

MR K P SCHUPKE k.schupke at imperial.ac.uk
Wed Oct 13 10:02:30 EDT 2004


>look at the user manual.

Okay, I see the Generic type class stuff does not support multi
parameter type classes. I guess I am stuck - any suggestions as to
how best do this? 

I wish to be able to derive type level labels for datatypes, like  
the following: 

data Fred a = Fred a deriving TTypeable

generates the instance:

instance TTypeable a al => TTypeable (Fred a) (NCons (N3 (N4 (N5 Nil))) (TCons al Nil))

where (N3 (N4 (N5 Nil))) is the result of a hash function on the name "Fred".

I have looked at TcDeriv but I don't know enough of the compiler internals to see
how this would be added to the current implementation... Can you give me some pointers
on how to do this?

Keean.


More information about the Glasgow-haskell-users mailing list