[Haskell-cafe] Lazy Evaluation in Monads
limestrael at gmail.com
Tue May 31 22:35:26 CEST 2011
No, I think Artyom meant "assuming IO is lazy".
He intended to show that, indeed, it is not, or else side-effects would
never be performed
2011/5/31 Scott Lawrence <bytbox at gmail.com>
> On 05/31/2011 04:20 PM, Artyom Kazak wrote:
> > Suppose iRecurse looks like this:
> > iRecurse = do
> > x <- launchMissiles
> > r <- iRecurse
> > return 1
> > As x is never needed, launchMissiles will never execute. It obviously is
> > not what is needed.
> Prelude> let launchMissiles = putStrLn "UH OH" >> return 1
> Prelude> let iRecurse = launchMissiles >> return 1
> Prelude> iRecurse
> UH OH
> Looks like launchMissiles /does/ execute, even though x is (obviously)
> never needed.
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe