Hi Emil,

Your  problem is related to "how are things evaluated" not "when". The
short answer is: if you want to make sure an expression is evaluated
before you lift it, don't use quasiquotes, call
Language.Haskell.TH.lift

On Thu, Mar 13, 2008 at 9:00 AM, Emil Axelsson <[EMAIL PROTECTED]> wrote:
>      a1 = [| (2::Int) + 2 |]

You are lifting the expression AST, not its evaluation. a1 = lift
((2::Int) + 2) would work as you want.


>      a2 = let x = (2::Int) + 2 in [| x |]

here you are enclosing a local variable in quasiquotes and, thus, [| x
|] is equivalent to "lift x"

>      a3 = [| y |]
>        where
>          y = (2::Int) + 2

Same as in a2, y is local. Therefore [| y |] is equivalent to "lift y"

>      z = (2::Int) + 2
>
>      a4 = [| z |]

z is a global variable and [| z |] is lifted to a variable expression
(i.e. a4 is equivalent to "varE 'z"  )
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to