[Template-haskell] Question about local bindings

Andy Gill andy at galois.com
Mon Apr 17 00:57:28 EDT 2006


Fellow Templaters,

Why does

test2 () = runQ [| foldr f z xs |]
(f,z,xs) = undefined

compile fine, but

test2 () = runQ [| foldr f z xs |]
    where (f,z,xs) = undefined

fail with this message:

./Language/Haskell/ER/Equation.hs:108:25:
     Can't splice the polymorphic local variable `f'
     In the first argument of `foldr', namely `f'
     In the first argument of `runQ', namely `[| foldr f z xs |]'
     In the definition of `test2':
         test2 ()
                 = runQ [| foldr f z xs |]
                 where
                     (f, z, xs) = undefined

Andy Gill



More information about the template-haskell mailing list