[Haskell-cafe] Template Haskell messes up scoping?
Claus Reinke
claus.reinke at talk21.com
Sun Mar 29 16:01:29 EDT 2009
> It looks like the scope is interrupted just above $( ... ) - but I'd
> like to know why and find a more beautiful way than just moving all th
> calls to the bottom of the module file :)
Top-level splices can introduce bindings. IIRC, the current TH
implementation uses a simple sequencing approach, preventing
splices to be part of a recursive dependency chain. If you have
A; $(S); B
then first A is compiled, then S, then B. So, B can refer to what
S builds, but neither A nor S can refer to B.
Btw, there is a TH mailing list, and a wiki page with links to
tutorials and papers, needed given the sparsity of the Haddocks:
http://www.haskell.org/haskellwiki/Template_Haskell
Claus
More information about the Haskell-Cafe
mailing list