[Template-haskell] RE: Template Haskell, [p|...|]

Simon Peyton-Jones simonpj@microsoft.com
Thu, 3 Jul 2003 11:23:35 +0100

There's a separate Template Haskell mailing list, which it'd be worth
ccing on this (are you on it)?

Ian Lynagh has a home page for Template Haskell, at

[IAN: it'd be worth noting the current unimplemented features of TH on
the home page, perhaps.  And is the TH page linked from Haskell.org?
Couldn't find the link, if it exists.]

| 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 =3D [p| $x : $xs |]

Yes -- pattern splices are not implemented at all.  The user manual
should say this, but doesn't. There are good reasons for this, as you'll
see by looking at the TH mailing list archive.

| Trying to use the standard list representation by
|    pcons x xs =3D Pcon "(:)" [x,xs]
| I got the error message
|    Data constructor not in scope: `(:)'
|    tcLookupDataCon: `(:)' is not in scope

You need to say "GHC.Base::" to name precisely the (:) defined by GHC.
This is clearly Bad and Horrible, and is on the list for a radical clean

Tim Sheard is working on a design document describing what we have in
mind.  Tim?