3 Feb 2006 21:44
6 Feb 2006 09:48
RE: Splice Imports
Simon Peyton-Jones <simonpj <at> microsoft.com>
2006-02-06 08:48:19 GMT
2006-02-06 08:48:19 GMT
| Could module import splicing be added into Template Haskell? Other than | updating the syntax and pretty printer in Language.Haskell.TH, what else | would need to be done? So you want to be able to say $(f 4) and have that expand to import X or import Y or whatever? That seems convenient, and it's not very hard to implement. Import statements have to become regular declarations, able to appear anywhere; we need TH syntax for them; and so on. It came up a while ago, and Lemmih was quite keen to do it. But I've held off doing it because it'll break ghc -M and ghc --make. It'll mean that GHC can't figure out dependencies until it's actually compiling. This is an issue even for crude Cpp-ery, but we run CPP before ghc -M and ghc --make. That's not possible for TH because you have to typecheck the module before running the splices. One could say that the programmer has to write his own dependencies in the makefile, but that still doesn't help with ghc --make. I don't see an easy path. Anyway that's why it's remained un-done.(Continue reading)
RSS Feed