Re: example of derive using Template Haskell?
"S. Alexander Jacobson" <[email protected]> Tue, 11 Jan 2005 15:37:56 -0500 (Eastern Standard Time)
| Newsgroups | gmane.comp.lang.haskell.template |
|---|---|
| Message-ID | <Pine.WNT.4.61.0501111532510.3932@philo> |
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 <[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 >