[Haskell-cafe] MonadPlus versus Alternative
dmbarbour at gmail.com
Sun Oct 30 05:50:47 CET 2011
MonadPlus is `or` semantics, as is Alternative. It does, indeed, reflect
the Applicative/Monad difference.
On Sat, Oct 29, 2011 at 8:02 PM, Gregory Crosswhite
<gcrosswhite at gmail.com>wrote:
> 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.)
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe