[Haskell-cafe] MonadPlus versus Alternative

David Barbour 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.)
>
> Thanks!
> Greg
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20111029/5c4ba8d2/attachment.htm>


More information about the Haskell-Cafe mailing list