Keean Schupke k.schupke at
Wed Oct 13 11:02:46 EDT 2004

Yes, I could quite easily write the generator in TemplateHaskell (have 
played with it before)
_but_ I don't like the $(xxx) syntax... Perhaps if Simon could be 
persuaded to allow deriving
clauses to be defined in TH?

data X x = X x
$(deriveMyClass (reify X))

could perhaps be defined from

data X x = X x deriving MyClass

I saw the same suggestion earlier today on the Haskell list...


Andre Pang wrote:

> On 13/10/2004, at 10:02 AM, MR K P SCHUPKE wrote:
>> 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))
> If you are happy to live on the edge a bit (which you seem to be happy 
> with, considering that you're playing with GHC CVS ;), Template 
> Haskell might be one way to do it.  See "Template Haskell: A Report 
> from the Field", a paper where Ian Lynagh does exactly what you're 
> trying to do:

More information about the Glasgow-haskell-users mailing list