
21 Jan
2012
21 Jan
'12
12:57 p.m.
* Victor S. Miller
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.
I'm not aware of any semantics that would require that. According to a monad law, return x >>= f should be equivalent to (f x). In particular, return x >>= const (return ()) is equivalent to (const (return ()) x) or simply (return ()). So, const is non-strict in its second argument even when used in (>>=). -- Roman I. Cheplyaka :: http://ro-che.info/