Derived instances

Fernand quarantedeux42 at yahoo.fr
Fri Aug 31 04:30:16 EDT 2007


Hi,

I have just discovered Generics in Haskell and, writing some code with 
GHC, I wondered about the portability of my code. It is possible I 
overlooked something in the GHC documentation but I did not found a way 
to obtain, let say, the haskell code for the derived classes. I mean, 
having the following type declaration :

 > data Something = This | That deriving (Eq, Ord, Typeable, Data)

I can use the -fgenerics to automatically derive instances for 
Something. But I could wish to have the generated source code for those 
instances (like, I suppose, the DrIft tool does), for instance, to 
compile my source with another compiler, which does not support Generics.

Is that possible ?

Thank you,

Fernand


More information about the Glasgow-haskell-users mailing list