[Haskell-cafe] automatic instance derivation

Bulat Ziganshin bulat.ziganshin at gmail.com
Sat Aug 19 03:00:10 EDT 2006


Hello Greg,

Saturday, August 19, 2006, 3:42:45 AM, you wrote:

> -- Is something like this possible?
> derive Show Val2

yes, in proposal :)

well, the best practical way i know is to use Template Haskell / DrIFT.
I can give your a TH module which generates Show instances. So, using
it will as easy as

import THShow
....
$(deriveShow Val2)

of course, TH is GHC-only solution. you can prefer DrIFT what is a
general preprocessor and afair it contains a lot of prewritten
instance-generation modules


-- 
Best regards,
 Bulat                            mailto:Bulat.Ziganshin at gmail.com



More information about the Haskell-Cafe mailing list