[Template-haskell] instance of Lift for Exp
Duncan Coutts
duncan.coutts at worcester.oxford.ac.uk
Tue Jul 20 13:43:17 EDT 2004
On Tue, 2004-07-20 at 11:06, Simon Peyton-Jones wrote:
> Thanks for the offer.
>
> Has anyone else encountered a need for this? Duncan, would you like to
> give some motivating examples?
I probably overestimated its general usefulness. I use it (actually
something very similar) to help write TH programs that manipulate and
produce other TH programs. (TH can't directly represent TH programs so
we have to use encodings)
> For the present, I'm inclined to leave it as a user library.
Seems reasonable. It's quite simple so I might try & get it to use the
new simple library build spec.
Also, Ian thought it would not work well with ghc's bootstrap build
system. He thought that the libs get build with a stage2 ghc which does
not have ghci and therefore does not have TH enabled so my library would
not build anyway if it were distributed with ghc. Is this right? Can
libs distributed with ghc not use TH syntax?
While on the topic of TH, let me float "yet another idea"TM
Include {-# #-} pragmas in the TH abstract syntax.
Why? Because it would allow domain/library-specific hints and
annotations.
data Pragma = PragmaGhcRule ...
PragmaGhcSpecialise ...
PragmaOther String --free form
My application of this might be to let the user indicate binding times
when doing partial evaluation, eg:
{-# BT foo :: Static -> Dynamic -> Dynamic #-}
foo :: Int -> Int -> int
foo x y = ...
Duncan
More information about the template-haskell
mailing list