[Haskell-cafe] Re: A question about "monad laws"

Ben Franksen ben.franksen at online.de
Mon Feb 11 18:38:02 EST 2008


Dan Piponi wrote:
> IOn Feb 11, 2008 9:46 AM, Miguel Mitrofanov <miguelimo38 at yandex.ru> wrote:
>> It's well known that "ListT m" monad violates this law in general
>> (though it satisfies it for some particular monads m). For example,
> 
> I went through this example in quite a bit of detail a while ago and
> wrote it up here:
> http://sigfpe.blogspot.com/2006/11/why-isnt-listt-monad.html . I tried
> to show not just why the monad laws fails to hold for ListT [], but
> also show how it almost holds.

...and the Unimo paper[1] explains how to easily write a 'correct' ListT.
BTW, Unimo is an extreme case of the monad laws holding only w.r.t.
the 'right' equality, i.e. in the laws m == m' is to be understood as

  observe_monad m == observe_monad m'

(and even this '==' is of course /not/ the Eq class method but a semantic
equality.)

[1] http://web.cecs.pdx.edu/~cklin/papers/unimo-143.pdf

Cheers
Ben



More information about the Haskell-Cafe mailing list