[Template-haskell] Question about local bindings
Simon Peyton-Jones
simonpj at microsoft.com
Tue Apr 18 08:01:45 EDT 2006
Check out Section 9.2 in the original TH paper. What you are trying to
do is akin to 'genSwap' in that section.
In general f depends on the arguments to test2, and so must be converted
to code. The paper says this at greater length.
Simon
| -----Original Message-----
| From: template-haskell-bounces at haskell.org
[mailto:template-haskell-bounces at haskell.org] On
| Behalf Of Andy Gill
| Sent: 17 April 2006 05:57
| To: template-haskell at haskell.org
| Subject: [Template-haskell] Question about local bindings
|
| 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
|
| _______________________________________________
| template-haskell mailing list
| template-haskell at haskell.org
| http://www.haskell.org/mailman/listinfo/template-haskell
More information about the template-haskell
mailing list