<br><div class="gmail_quote">2011/3/22 Philippa Cowderoy <span dir="ltr">&lt;<a href="mailto:postmaster@flippac.org">postmaster@flippac.org</a>&gt;</span><br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
This is what newtypes are for, no?<br></blockquote><div><br><br>I did not think of that approach. I&#39;m not sure how well it would work out, but it would solve another problem I have, which is the duplication of combinators many, some, and optional. Each of these could exist in two forms, the lazy one and the greedy one, and the only difference is the underlying choice combinator, (&lt;|&gt;) vs. (&lt;&lt;|&gt;).<br>
<br>I&#39;m not aware of any other parsing library taking this road, though, and there must be a good reason. I&#39;ll try and see.<br> <br><br></div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div><div class="h5"><br><div class="gmail_quote">2011/3/22 Mario Blažević <span dir="ltr">&lt;<a href="mailto:mblazevic@stilo.com" target="_blank">mblazevic@stilo.com</a>&gt;</span><br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">

<div><br>
</div>
<div class="gmail_quote"><div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">This seems very interesting. One question:<br>
<br>
&gt; The MonadPlus and the Alternative instance differ: the former&#39;s mplus<br>
&gt; combinator equals the asymmetric &lt;&lt;|&gt; choice.<br>
<br>
Why?<br>
</blockquote></div><div><br><br>    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.<br>

</div></div></blockquote><div><br></div>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.</div>

<div class="gmail_quote"><br></div><div class="gmail_quote">Every library I am aware of to date, save of course this one, has maintained their compatibility.</div><div class="gmail_quote"><br></div><div class="gmail_quote">

If the instance for Alternative satisfies the underspecified MonadPlus laws, I&#39;d just as soon have the &#39;useless redundant&#39; instance. The power of MonadPlus is in the combinators that are built on top of it. Not in the primitives themselves.</div>

<div class="gmail_quote"><br></div><div class="gmail_quote">If the Alternative instance would not be a legal MonadPlus instance, then I&#39;d feel much less queasy with your second scenario, and it simply removed. </div>
<div class="gmail_quote">
<br></div><div class="gmail_quote">-Edward</div>
</div></div></blockquote></div><br><br>