29 Jun
2008
29 Jun
'08
8:08 p.m.
Hi David, On Sun, Jun 29, 2008 at 03:25:47PM -0400, David Walker wrote:
{| pdata Line = Comment /#.*/ | Name {first::Pstr /;/, last ::Pstr /\n/}
ptype Friends = (x::Pint, |{ x > 0 }|, /\n/, PlistFW x) |}
You can't create new syntax with TH; it's just Haskell (plus the TH syntactic extensions themselves, i.e. $( e ), and a few variants of [| e |]). You'd have to encode the info into Haskell syntax somehow, e.g. something like $( pdata "Line" [C "Comment" [], C "Name" [ ("first", ["Pstr", "/;"]), ... ) or parse them from strings (which isn't nice either, as Haskell doesn't have nice multi-line strings). Thanks Ian