patch applied (ghc): Three improvements to Template Haskell
(fixes #3467)
Duncan Coutts
duncan.coutts at worc.ox.ac.uk
Thu Sep 10 16:19:49 EDT 2009
On Thu, 2009-09-10 at 06:41 -0700, Simon Peyton Jones wrote:
> Nested top-level splices
> ~~~~~~~~~~~~~~~~~~~~~~~~
> Previously TH would reject this, saying that splices cannot be nested:
> f x = $(g $(h 'x))
> But there is no reason for this not to work. First $(h 'x) is run,
> yielding code <blah> that is spliced instead of the $(h 'x). Then (g
> <blah>) is typechecked and run, yielding code that replaces the
> $(g ...) splice.
>
> So this simply lifts the restriction.
Cool. I remember when I was working on partial evaluation / program
specialisation that this was an annoying restriction.
So now we can all write programs that generate programs that generate
programs... to our heart's content.
Duncan
More information about the Cvs-ghc
mailing list