logo       

Template Haskell, [p|...|]: msg#00004

lang.haskell.glasgow.bugs

Subject: Template Haskell, [p|...|]

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


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise