suggestion: use lazy pattern matching for Monoid instances of tuples

Herbert Valerio Riedel hvr at gnu.org
Sun Aug 18 22:15:57 CEST 2013


On 2013-08-18 at 20:26:23 +0200, Petr Pudlák wrote:

[...]

> I'd say that with `undefined` we can fail other equality laws. For
> example: For `MonadPlus` we have `m >>= (\x -> mzero) == mzero`. But
> it clearly fails in
> ```haskell
> undefined >>= (\x -> mzero) :: Maybe Int
> ```
> The result is `undefined` instead of `mzero`. (Or does it mean that
> Maybe is broken?)

Btw/fyi, there was a thread "Monad laws in presence of bottoms" some
time ago on haskell-cafe that seems related:

 http://haskell.1045720.n5.nabble.com/Monad-laws-in-presence-of-bottoms-td5499903.html


cheers,
  hvr




More information about the Libraries mailing list