<div dir="auto"><div>I think the iffy feeling comes from the proposal breaking the distributive law. For example:</div><div dir="auto"><br></div><div dir="auto">(Right f <|> Right g) <*> Left x</div><div dir="auto"> = Left x</div><div dir="auto"><br></div><div dir="auto">but</div><div dir="auto"><br></div><div dir="auto">(Right f <*> Left x) <|> (Right g <*> Left x)</div><div dir="auto"> = Left (x <> x)</div><div dir="auto"><br><div class="gmail_quote" dir="auto"><div dir="ltr">On Thu, Jun 14, 2018, 22:42 Tony Morris <<a href="mailto:tonymorris@gmail.com" target="_blank" rel="noreferrer">tonymorris@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div text="#000000" bgcolor="#FFFFFF">
<p>Alternatively :) or more like, something to think about, an Alt
instance for Either.<br>
<br>
class Alt f where<br>
(<!>) :: f a -> f a -> f a<br>
<br>
instance Alt Either where<br>
Right b <!> _ = Right b<br>
Left a <!> x = x</p>
<p><a class="m_3482862310213372553m_-5925346593809272039moz-txt-link-freetext" href="https://hackage.haskell.org/package/semigroupoids/docs/Data-Functor-Alt.html" rel="noreferrer noreferrer" target="_blank">https://hackage.haskell.org/package/semigroupoids/docs/Data-Functor-Alt.html</a></p>
<p>There is something iffy about Monoid e => Alternative (Either
e) but I can't put my finger on it.<br>
</p>
<br>
<div class="m_3482862310213372553m_-5925346593809272039moz-cite-prefix">On 06/14/2018 08:37 PM, Nathan van
Doorn wrote:<br>
</div>
<blockquote type="cite">
<div dir="ltr">Proposal: add:
<div><br>
</div>
<div><font face="monospace, monospace">instance Monoid e =>
Alternative (Either e) where</font></div>
<div><font face="monospace, monospace"> empty = Left mempty</font></div>
<div><font face="monospace, monospace"> Left a <|> Left b
= Left (a `mappend` b)</font></div>
<div><font face="monospace, monospace"> Right a <|> _ =
Right a</font></div>
<div><font face="monospace, monospace"> _ <|> Right b =
Right b</font></div>
<div><font face="monospace, monospace"><br>
</font></div>
<div><font face="monospace, monospace">instance Monoid e =>
MonadPlus (Either e) where</font></div>
<div><font face="monospace, monospace"> ...</font></div>
<div><font face="monospace, monospace"><br>
</font></div>
<div><font face="arial, helvetica, sans-serif">to base.</font></div>
<div><font face="arial, helvetica, sans-serif"><br>
</font></div>
<div><font face="arial, helvetica, sans-serif">This is a
reasonably obvious instance which I am pretty sure is law
abiding.</font></div>
<div><font face="arial, helvetica, sans-serif"><br>
</font></div>
<div><font face="arial, helvetica, sans-serif">It'd be useful
for defining a series of computations which may fail, where
we only care about one success.</font></div>
</div>
<br>
<fieldset class="m_3482862310213372553m_-5925346593809272039mimeAttachmentHeader"></fieldset>
<br>
<pre>_______________________________________________
Libraries mailing list
<a class="m_3482862310213372553m_-5925346593809272039moz-txt-link-abbreviated" href="mailto:Libraries@haskell.org" rel="noreferrer noreferrer" target="_blank">Libraries@haskell.org</a>
<a class="m_3482862310213372553m_-5925346593809272039moz-txt-link-freetext" href="http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries" rel="noreferrer noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries</a>
</pre>
</blockquote>
<br>
</div>
_______________________________________________<br>
Libraries mailing list<br>
<a href="mailto:Libraries@haskell.org" rel="noreferrer noreferrer" target="_blank">Libraries@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries" rel="noreferrer noreferrer noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries</a><br>
</blockquote></div></div></div>