[Template-haskell] TH problem

Ch. A. Herrmann Christoph.Herrmann at uni-passau.de
Tue Nov 29 11:54:37 EST 2005


Dear TH gurus,

I'm desperately trying to convert the old TH examples to work with ghc-6.4.1
and got stuck with a problem I cannot explain. Although the splice seems
to be correct, the compiler complains about the (:) in the gerated
pattern match.
I appended the source files. They are not very nice right now, because all
guidance I have are the types generated by haddock and all effort I spent
was to make them fit somehow.
Please tell me where the error is and how to proceed or, even
better, please send me the corrected source files back.

Many thanks in advance.

Christoph
----------------------------------------------------------------------------------------
Loading package base-1.0 ... linking ... done.
Compiling Zip              ( ./Zip.hs, interpreted )
Compiling Sel              ( ./Sel.hs, interpreted )
Compiling Main             ( Main.hs, interpreted )
Loading package haskell98-1.0 ... linking ... done.
Loading package haskell-src-1.0 ... linking ... done.
Loading package template-haskell-1.0 ... linking ... done.
Main.hs:16:18:
     Main.hs:16:18-23: Splicing expression
         zipN 3
       ======>
         let
           zp[a4fV] = \ y1 y2 y3
                          -> case (y1, y2, y3) of
                               (x1 : xs1, x2 : xs2, x3 : xs3)
                                 -> ((x1, x2, x3) `GHC.Base.:` (zp[a4fV]
xs1 xs2 xs3))
                               (_, _, _) -> GHC.Base.[]
         in zp[a4fV]
     In the second argument of `($)', namely `$[splice](zipN 3) as bs cs'
     In a 'do' expression: print $ ($[splice](zipN 3) as bs cs)
     In the definition of `main':
         main = do
                  let as = ['a' .. 'e']
                      bs = map toUpper as
                      cs = map ord as
                  print $ ($[splice](zipN 3) as bs cs)
                  let ds = [1 .. ]
                  print $ ($[splice](zipN 4) ds as bs cs)
                  print $ ($[splice](sel 1 3) (2, 'a', 6))

Main.hs:16:18: Not in scope: data constructor `:'

Main.hs:16:18: Not in scope: data constructor `:'

Main.hs:16:18: Not in scope: data constructor `:'
Failed, modules loaded: Sel, Zip.
--
  Christoph





-------------- next part --------------
A non-text attachment was scrubbed...
Name: Sel.hs
Type: text/x-haskell
Size: 534 bytes
Desc: not available
Url : http://www.haskell.org//pipermail/template-haskell/attachments/20051129/e8bf712f/Sel-0001.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Zip.hs
Type: text/x-haskell
Size: 1083 bytes
Desc: not available
Url : http://www.haskell.org//pipermail/template-haskell/attachments/20051129/e8bf712f/Zip-0001.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Main.hs
Type: text/x-haskell
Size: 1246 bytes
Desc: not available
Url : http://www.haskell.org//pipermail/template-haskell/attachments/20051129/e8bf712f/Main-0001.bin


More information about the template-haskell mailing list