Template Haskell, [p|...|]
Ch. A. Herrmann
herrmann at fmi.uni-passau.de
Thu Jul 3 04:39:02 EDT 2003
Hi,
trying to adapt the zipN-example in the paper
"Template Meta-programming for Haskell" by
Sheard and Peyton Jones to Language.Haskell.THSyntax
I found that quasi-quotation for patterns does not seem
to work with ghci-6.0, e.g., the following results in
"Parse error in pattern":
pcons x xs = [p| $x : $xs |]
Using a user defined data-type
data List a = Nil | Cons a (List a)
the following works
pcons x xs = Pcon "Cons" [x,xs]
but I don't want to use a new data type.
Trying to use the standard list representation by
pcons x xs = Pcon "(:)" [x,xs]
I got the error message
Data constructor not in scope: `(:)'
tcLookupDataCon: `(:)' is not in scope
Does anyone know a workaround?
--
Christoph
More information about the Glasgow-haskell-bugs
mailing list