On 5/4/08, Iavor Diatchki <[EMAIL PROTECTED]> wrote:
> >From the monad law we can conclude only that "(>>= return)" is strict,
> not (>>=) in general.
> For example, (>>=) for the reader monad is not strict in its first argument:
>
> m >>= f = \r -> f (m r) r
>
> So, "(undefined >> return 2) = (return 2)"

That's not even true here, though, with regards to seq.

undefined >>= return
= \r -> return (undefined r) r
= \r -> const (undefined r) r
= \r -> undefined r

But

seq undefined 0 = _|_
seq (undefined >>= return) 0
   = seq (\r -> undefined r) 0
   = 0

The monad laws just aren't true for many monads once seq is a possibility.

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

Reply via email to