[Haskell-cafe] Monad laws

David Sabel sabel at ki.informatik.uni-frankfurt.de
Tue Mar 2 15:17:06 EST 2010

when checking the first monad law (left unit) for the IO-monad (and also 
for the ST monad):

return a >>= f ≡ f a

I figured out that there is the "distinguishing" context (seq [] True) 
which falsifies the law
for a and f defined below

 > let a = True
 > let f = \x -> (undefined::IO Bool)
 > seq (return a >>= f) True
 > seq (f a) True
*** Exception: Prelude.undefined

Is there a side-condition of the law I missed?


More information about the Haskell-Cafe mailing list