Template Haskell Question: Spliced expr. of type TypeQ
Hi, maybe someone can help me with this: I was wandering if I could do something similar to Depended Types using Template-Haskell. The documentation of GHC (6.2.2 and 6.4) says that a splice may occur in place of a type, but I get a parse error when I try that. So here is what I did: made a Module Templates: module Templates where expr = [| 1337*7331 |] decl = [d| hello = putStr "Hello\n"|] ty = [t| Int |] and made test file: import Templates $(decl) -- works well (tested with ghci) e = $(expr) -- works also well i :: ($tyr) -- gives a parse error i = 1 I would be really happy if someone knows how to make the last example must be written, or if that works at all. (If not, maybe the Documentation should get updated) and thanks you for reading this posting, anyway. -- Eike
Eike M. Scholz@gmx.de wrote:
I was wandering if I could do something similar to Depended Types using Template-Haskell. The documentation of GHC (6.2.2 and 6.4) says that a splice may occur in place of a type, but I get a parse error when I try that.
From the TH homepage (http://www.haskell.org/th/)... " Not all of even the original design has been implemented yet. The known issues are: * You can only splice in lists of declarations and expressions, not * types, patterns etc " ..and it gives a link... http://haskell.org/pipermail/template-haskell/2003-February/000021.html Maybe that's the key? Greg Buchholz
participants (2)
-
Eike M. Scholz@gmx.de -
Greg Buchholz