
5 May
2008
5 May
'08
6:59 p.m.
On 5/4/08, Iavor Diatchki
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