Re: declaration splicing

WANG Meng <[email protected]> Mon, 14 Mar 2005 01:38:25 +0800 (GMT-8)
Newsgroups gmane.comp.lang.haskell.template
Message-ID <[email protected]>
> >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
> <[email protected]> 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
>