Re: example of derive using Template Haskell?

Lemmih <[email protected]> Tue, 11 Jan 2005 19:17:10 +0100
Newsgroups gmane.comp.lang.haskell.template
Message-ID <[email protected]>
On Tue, 11 Jan 2005 12:35:40 -0500 (Eastern Standard Time), S.
Alexander Jacobson <[email protected]> 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