Re: patch applied (ghc): Three improvements to Template Haskell (fixes #3467)
Isaac Dupree <[email protected]> Fri, 11 Sep 2009 19:31:25 -0400
| Newsgroups | gmane.comp.lang.haskell.cvs.ghc,gmane.comp.lang.haskell.template |
|---|---|
| Message-ID | <[email protected]> |
Simon Peyton-Jones wrote: > | > 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 = T1 | T2 > | > deriveMyStuff ''T > | > | Nice. > | > | 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 > | > | data T = T1 | T2 > | deriveMyStuff (type T) > | > | 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? well, sometime there was a suggestion for (constructor T) syntax in export-lists. Which seems to overlap, sort of, with the "value" idea -- (value T)? Although it almost seems like *that* ought to export just the constructor-function, not the deconstructor (pattern match) ... -Isaac