[Haskell-cafe] Re: Control.Exception.evaluate - 'correct
definition' not so correct
Ryan Ingram
ryani.spam at gmail.com
Mon May 5 14:59:25 EDT 2008
On 5/4/08, Iavor Diatchki <iavor.diatchki at gmail.com> 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
More information about the Haskell-Cafe
mailing list