[Haskell-cafe] Monad laws

Tom Phoenix rootbeer at redcat.com
Thu Sep 7 10:49:40 EDT 2006

On 9/6/06, Deokhwan Kim <dk at ropas.snu.ac.kr> wrote:

> What is the practical meaning of monad laws?

A compiler may re-write any monadic computations, for efficiency or
other reasons, under the assumption that the monad laws are valid. If
the monad laws aren't valid, this re-writing produces a different
function than the programmer wrote.

Even though compilers aren't required to be "aware" of the monad laws,
other programmers are. So, even if your compiler doesn't do any
re-writing, another programmer who works on your code may essentially
do the same thing.

Hope this helps!

--Tom Phoenix

More information about the Haskell-Cafe mailing list