[Haskell-cafe] Monads, do and strictness

MigMit miguelimo38 at yandex.ru
Sat Jan 21 18:53:03 CET 2012

On 21 Jan 2012, at 21:29, Victor S. Miller wrote:

> The "do" notation translates
> do {x <- a;f}  into
> a>>=(\x -> f)
> However when we're working in the IO monad the semantics we want requires that the lambda expression be strict in its argument.  So is this a special case for IO?  If I wanted this behavior in other monads is there a way to specify that?

No, why? The (>>=) combinator (for the IO monad) is strict on it's first argument, that's all. We don't impose any special requirements on the lambda expression.

More information about the Haskell-Cafe mailing list