[Haskell-cafe] Do monads imply laziness?

Brian Hurt bhurt at spnz.org
Sat Apr 14 10:56:44 EDT 2007


This is probably an off-topic question, but I can't think of a better 
forum to ask it: does the existance of monads imply laziness in a 
language, at least at the monadic level?

Consider the following: a purely functional, eagerly evaluated programming 
language, that uses monads to encapsulate the awkward squad.  In this 
programming language, a program generates an IO monad whose encapsulating 
computation performs side effecting affections- it writes to stdout, say. 
But this generated monad never has it's value evaluated- the monad is 
tossed away uninspected.  Does the side effect happen?  If the answer is 
at least potientially "no", then monads are lazily evaluated, and thus 
monads imply laziness (at least at the monadic level).  On the other hand, 
if the answer is "yes", then monads do not imply laziness.

Thanks,
Brian



More information about the Haskell-Cafe mailing list