On 12/4/07, Simon Marlow <[EMAIL PROTECTED]> wrote:
>   do
>      x <- newIVar
>      let y = readIVar x
>      writeIVar x 3
>      print y
>
> (I wrote the let to better illustrate the problem, of course you can inline
> y if you want).  Now suppose the compiler decided to evaluate y before the
> writeIVar.  What's to prevent it doing that?

Look at the translation:

newIVar >>= (\x -> let y = readIVar x in writeIVar x 3 >> print y)

y can't be floated out because it depends on x.

-- 
Taral <[EMAIL PROTECTED]>
"Please let me know if there's any further trouble I can give you."
    -- Unknown
_______________________________________________
Haskell mailing list
Haskell@haskell.org
http://www.haskell.org/mailman/listinfo/haskell

Reply via email to