[Template-haskell] Splicing in a TypQ == parse error?

Andre Pang ozone@algorithm.com.au
Wed, 14 May 2003 18:30:34 +1000


Hi all,

How do you splice in a type in Template Haskell?  The quasi-quote 
notation seems to work succesfully, but attempting to splice it gives 
me a parse error:

MyTypes.hs:

     module MyTypes where

     import Language.Haskell.THSyntax

     stringType = [t| String |]

SpliceType.hs:

     module SpliceType

     where

     import Language.Haskell.THSyntax

     foo :: $(stringType) -> $(stringType)
     foo x = x ++ "foo"

Compiling it:

     18:28[18] ~/th/new % ghc -fglasgow-exts SpliceType.hs
     SpliceType.hs:7: parse error on input `$('

The same happens if I try to to write "data Foo = Foo $(stringType)" in 
SpliceType.hs.  Am I getting the syntax wrong, or is splicing types not 
implemented yet?  I'm using a May 13, 2003 build of GHC.

Merci,


-- 
% Andre Pang : trust.in.love.to.save