example of derive using Template Haskell?
"S. Alexander Jacobson" <[email protected]> Mon, 10 Jan 2005 21:45:20 -0500 (Eastern Standard Time)
| Newsgroups | gmane.comp.lang.haskell.template |
|---|---|
| Message-ID | <Pine.WNT.4.61.0501102134470.3932@philo> |
Does [d|...] work in 6.2.2 and if so, how do I
enable it?
This code gives a syntax error:
{-# OPTIONS -fglasgow-exts #-}
module Tth where
import Language.Haskell.THSyntax
import Language.Haskell.Syntax
fooFunc = [d|funD "foo" [clause [] (normalB $ litE $ StringL "bar") [] ] |]
goo = [|2|]
---
{-# OPTIONS -fglasgow-exts #-}
import Tth
foo = $(goo)
$(fooFunc)
If I eliminate the d in "[d|" I get an error about
Dec conflicting with Exp.
I can actually use template Haskell in 6.2.2, can
anyone provide an example of deriving a class?
-Alex-
______________________________________________________________
S. Alexander Jacobson tel:917-770-6565 http://alexjacobson.com