[Template-haskell] Using a Typ as a Type

Simon Peyton-Jones simonpj@microsoft.com
Thu, 4 Sep 2003 09:18:28 +0100


Tim and I are working on this very thing right now.  Stay tuned

Simon

| -----Original Message-----
| From: Alastair Reid [mailto:alastair@reid-consulting-uk.ltd.uk]
| Sent: 03 September 2003 16:17
| To: Simon Peyton-Jones; Alastair Reid; template-haskell@haskell.org
| Subject: Re: [Template-haskell] Using a Typ as a Type
|=20
| On Wednesday 03 September 2003 2:19 pm, Simon Peyton-Jones wrote:
| > | > TH doesn't support type splices today; that's one of the things
I'm
| > | > actively working on.  But I'm not sure if this is what you
meant.
|=20
| btw Something that would be very nice is if $ could be used to splice
patterns
| and declarations as well as expressions so that I could write:
|=20
| foo :: String -> Q [Dec]
| foo x =3D [| \ $(pat x) -> $(var x) |]
|=20
| or
|=20
| bar :: Q Expr -> Q Dec -> Q [Dec]
| bar e binding =3D [| let $binding in $e |]
|=20
| These examples aren't that compelling but I've had to code round not
being
| able to write code like this lots of times.
|=20
| --
| Alastair
|=20
| ps This is quite independent of my request for type splices.  The
above makes
| it easier to write what you can already write whereas type splices
extend the
| power of TH to let you write things that aren't possible at the
moment.
|=20
|=20