On Tue, May 25, 2010 at 6:34 PM, Ross Paterson <span dir="ltr">&lt;<a href="mailto:ross@soi.city.ac.uk">ross@soi.city.ac.uk</a>&gt;</span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im">On Tue, May 25, 2010 at 04:55:09PM -0400, Edward Kmett wrote:<br>
&gt; In my perfect world the next version of transformers would provide an entry in<br>
&gt; Control.Monad.Instances for:<br>
&gt;<br>
&gt; instance Applicative (Either m)<br>
&gt; instance Alternative (Either m)<br>
&gt; instance Monad (Either m)<br>
&gt; instance MonadPlus (Either m)<br>
<br>
</div>What definition of empty/mzero do you have in mind?</blockquote><div><br></div><div>Thats what I get for dashing off my response half baked. =) Upon actually looking, the code that I have for that Applicative didn&#39;t supply an Alternative/MonadPlus instance, since there isn&#39;t a suitable &#39;Default&#39; class that provides a single value without a full monoid, and if it existed, you&#39;d want to use it to support &#39;fail&#39; </div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div class="im">
&gt; But there are quite possibly too many moving parts to make such a big<br>
&gt; jump, and then you have the other bikeshedding issue of there being<br>
&gt; yet another definition for Either that makes sense to default to:<br>
&gt;<br>
&gt; instance Monoid m =&gt; Applicative (Either m)<br>
&gt; instance Monoid m =&gt; Alternative (Either m)<br>
&gt; instance Monoid m =&gt; Monad (Either m)<br>
&gt; instance Monoid m =&gt; MonadPlus (Either m)<br>
<br>
</div>I can&#39;t think of a Monad instance that uses the Monoid constraint.<br>
What is the instance you mean?<br></blockquote><div><br></div><div>The Monoid instance only exists to provide mempty to support fail, in a manner consistent with the Alternative and MonadPlus instance as no weaker class exists to use to obtain a Default.</div>
<div><br></div><div>Neither answer is really entirely satisfying.</div><div><br></div><div>-Edward Kmett</div></div>