Question about local bindings

Andy Gill <[email protected]> Sun, 16 Apr 2006 21:57:28 -0700
Newsgroups gmane.comp.lang.haskell.template
Message-ID <[email protected]>
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