[Template-haskell] Using a Typ as a Type

Alastair Reid [email protected]
Wed, 3 Sep 2003 16:16:41 +0100

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.

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:

foo :: String -> Q [Dec]
foo x = [| \ $(pat x) -> $(var x) |]


bar :: Q Expr -> Q Dec -> Q [Dec]
bar e binding = [| let $binding in $e |]

These examples aren't that compelling but I've had to code round not being 
able to write code like this lots of times.


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.