RE: patch applied (ghc): Three improvements to Template Haskell (fixes #3467)
Simon Peyton-Jones <[email protected]> Fri, 11 Sep 2009 09:57:00 +0100
| Newsgroups | gmane.comp.lang.haskell.cvs.ghc,gmane.comp.lang.haskell.template |
|---|---|
| Message-ID | <638ABD0A29C8884A91BC5FB5C349B1C363F9B9F189@EA-EXMSG-C334.europe.corp.microsoft.com> |
| > Declaration-level splices with no "$" | > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | > This change simply allows you to omit the "$(...)" wrapper for | > declaration-level TH splices. An expression all by itself is | > not legal, so we now treat it as a TH splice. Thus you can now | > say | > data T =3D T1 | T2 | > deriveMyStuff ''T |=20 | Nice. |=20 | There has been talk int the cast about allowing things like | class T, type T | etc in the module export list. Perhaps you should also be able to say |=20 | data T =3D T1 | T2 | deriveMyStuff (type T) |=20 | rather than using the somewhat odd '' syntax. Interesting idea. You're making use of the *keyword* 'type', although it's= unexpected in an expression context. Trouble is, we lack a keyword for 'value'! I suppose we could invent one. = Thus module Foo( type T(..), class C, value f, value g ) and deriveMyStuff [type T, value f] I wonder if that would have merit? What do other TH afficionados think? Simon