[Haskell-cafe] ANNOUNCE: incremental-parser library package
Edward Kmett
ekmett at gmail.com
Tue Mar 22 18:47:50 CET 2011
2011/3/22 Mario Blažević <mblazevic at stilo.com>
>
> This seems very interesting. One question:
>>
>> > The MonadPlus and the Alternative instance differ: the former's mplus
>> > combinator equals the asymmetric <<|> choice.
>>
>> Why?
>>
>
>
> Good question. Basically, I see MonadPlus as a union of Monad and
> Alternative. The class should not exist at all. But as long as it does, I
> figured I should provide an instance, and I made it different from the
> Monoid+Alternative combination because otherwise it would be useless. My
> second choice would be to remove the instance completely.
>
I have to admit I really do not like having Applicative and MonadPlus with
different behavior. Yes, one is redundant, but that is more an artifact of
language evolution, than an intentional opportunity for diverging behavior.
Every library I am aware of to date, save of course this one, has maintained
their compatibility.
If the instance for Alternative satisfies the underspecified MonadPlus laws,
I'd just as soon have the 'useless redundant' instance. The power of
MonadPlus is in the combinators that are built on top of it. Not in the
primitives themselves.
If the Alternative instance would not be a legal MonadPlus instance, then
I'd feel much less queasy with your second scenario, and it simply removed.
-Edward
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20110322/03593b88/attachment.htm>
More information about the Haskell-Cafe
mailing list