* Victor S. Miller <victorsmil...@gmail.com> [2012-01-21 12:29:32-0500]
> 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/

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to