[Haskell-cafe] MonadPlus versus Alternative

Gregory Crosswhite gcrosswhite at gmail.com
Sun Oct 30 04:02:51 CET 2011

Hey everyone,

What is the difference between MonadPlus and Alternative?  In my mind, it would make sense for the difference to be that the former provides "and" semantics (i.e., x `mplus` y means do both x and y) whereas the latter provides "or" semantics (i.e., x <|> y means do x or y but not both).  However, when I look at the instances defined for List I see that it is exactly the same as MonadPlus.

So is there any difference between the interpretation of MonadPlus and Alternative, or is the only difference between them that the former applies to Monad whereas the latter applies to Applicative?

Also, along similar lines, why does MonadPlus exist when it is essentially just a special case of Monoid?  (That is, any MonadPlus instance could be equivalently cast as a Monoid instance.)

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20111030/c0f930a4/attachment.htm>

More information about the Haskell-Cafe mailing list