[Haskell-cafe] Monad laws

Deokhwan Kim dk at ropas.snu.ac.kr
Thu Sep 7 01:49:50 EDT 2006


What is the practical meaning of monad laws?

(M, return, >>=) is not qualified as a category-theoretical monad, if
the following laws are not satisfied:

  1. (return x) >>= f == f x
  2. m >>= return == m
  3. (m >>= f) >>= g == m >> (\x -> f x >>= g)

But what practical problems can unsatisfying them cause? In other words,
I wonder if declaring a instance of the Monad class but not checking it
for monad laws may cause any problems, except for not being qualified as
a theoretical monad?

Cheers,

-- 
Deokhwan Kim


More information about the Haskell-Cafe mailing list