patch applied (ghc): Three improvements to Template
Haskell (fixes #3467)
Isaac Dupree
ml at isaac.cedarswampstudios.org
Fri Sep 11 19:31:25 EDT 2009
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
More information about the Cvs-ghc
mailing list