[Haskell-cafe] Re: unsafeInterleaveIO respecting order of actions

roconnor at theorem.ca roconnor at theorem.ca
Thu Jan 1 20:22:26 EST 2009


On Fri, 2 Jan 2009, Achim Schneider wrote:

> There are no lazy monads. Monads imply explicit sequencing... writing

I think this is an extremely bad thing to say and is a source of 
misunderstanding about monads and evaluation.  Most monads _are_ lazy, and 
it is important to understand that when trying to understand the run-time 
properties of your monadic code.

Monads sequence effects, but evaluation is an almost orthogonal issue. 
Here is a recent thread where I talk about laziness:

http://www.reddit.com/r/haskell/comments/7itbi/mapm_mapm_and_monadic_statements/c06s6pm

(for the short short story, simply try out
> take 10 $ execWriter (sequence_ (repeat (tell "x")))
)

Furthermore, the code in my article on recursive do from The.Monad.Reader 
issue #6 <http://www.haskell.org/sitewiki/images/1/14/TMR-Issue6.pdf> 
requires the monads to be lazy in order to tie the knot.

-- 
Russell O'Connor                                      <http://r6.ca/>
``All talk about `theft,''' the general counsel of the American Graphophone
Company wrote, ``is the merest claptrap, for there exists no property in
ideas musical, literary or artistic, except as defined by statute.''


More information about the Haskell-Cafe mailing list