[Haskell-cafe] Lazy Evaluation in Monads
Yves Parès
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
> 1
> Prelude>
>
> Looks like launchMissiles /does/ execute, even though x is (obviously)
> never needed.
>
>
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20110531/9c5dca9c/attachment.htm>
More information about the Haskell-Cafe
mailing list