[Template-haskell] declaration splicing
WANG Meng
wangmeng at comp.nus.edu.sg
Sun Mar 13 12:38:25 EST 2005
> >From http://www.haskell.org/ghc/docs/6.4/html/users_guide/template-haskell.html:
> 'Note that the syntax for a declaration splice uses "$" not "splice"
> as in the paper. Also the type of the enclosed expression must be Q
> [Dec], not [Q Dec] as in the paper.'
Thank you for your reply. I also tried to use "$". But GHC gives
*Main> $(myparseDec "x=1")
<interactive>:1:
Couldn't match `Exp' against `Dec'
Expected type: ExpQ
Inferred type: Q Dec
In the application `myparseDec "x=1"'
In the definition of `it': it = $[splice](myparseDec "x=1")
It seems "$" only takes in an "Q Exp".
-W-M-
@ @
|
\_/
On Sun, 13 Mar 2005, Lemmih wrote:
> On Sun, 13 Mar 2005 23:31:28 +0800 (GMT-8), WANG Meng
> <wangmeng at comp.nus.edu.sg> wrote:
> > Hi All,
> >
> > I am trying to use template haskell to splice top level declarations.
> > However, GHC complains
> > "<interactive>:1: Variable not in scope: `splice'"
>
>
> --
> Friendly,
> Lemmih
>
More information about the template-haskell
mailing list