[Haskell-cafe] MonadPlus versus Alternative
gcrosswhite at gmail.com
Sun Oct 30 04:02:51 CET 2011
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...
More information about the Haskell-Cafe