[Template-haskell] example of derive using Template Haskell?

S. Alexander Jacobson alex at alexjacobson.com
Tue Jan 11 15:37:56 EST 2005


I seem to have missed the mail you sent. :- (
Could you resend?

-Alex-

______________________________________________________________
S. Alexander Jacobson tel:917-770-6565 http://alexjacobson.com


On Tue, 11 Jan 2005, Lemmih wrote:

> On Tue, 11 Jan 2005 12:35:40 -0500 (Eastern Standard Time), S.
> Alexander Jacobson <alex at alexjacobson.com> wrote:
>> I have {-# OPTIONS -fglasgow-exts #-} at the top
>> of both modules.  Does that not imply -fth?
>
> If you use GHC 6.2.2 then yes. This has changed in GHC 6.3.
>
>> I do realize that my example is not valid Haskell
>> code.  I am looking for an example of valid
>> Haskell code that allows me to derive a class.
>
> Checkout 'InstanceD' from the data structure 'Dec' and 'reifyDecl'.
>
>> Or even just an example of actualy usage of
>> [d|...] that works with GHC 6.2.2!
>>
>> SO far I haven't been able to find one.
>
> I mailed you an example not so long ago (-:
>
> These two splices are equivalent and work with GHC 6.2.2:
> $([d| baz = "Hello Template Haskell" |])
> $(do fn <- valD (varP "baz") (normalB (litE (stringL "Hello Template
> Haskell"))) []
>     return [fn])
>
> -- 
> Friendly,
>  Lemmih
>



More information about the template-haskell mailing list