<div dir="ltr">The issue is that you can't prove that whicher set of MonadPlus laws you are using _follows_ from whichever set of Alternative laws you are using.<br><br>This discussion is somewhat hampered by neither one having a well-written set of laws, because we use MonadPlus in two or three mutually incompatible ways and for the most part "it just works" so people don't notice.<br><br>Consider the space of laws mentioned in:<br><br><a href="https://wiki.haskell.org/MonadPlus_reform_proposal">https://wiki.haskell.org/MonadPlus_reform_proposal</a><br><br>These don't necessarily follow from any of the popular Alternative law proposals.<br><br>Left Zero:<br><br><div>On the Applicative side you can do more to explore the tree, can "run" effects right to left, etc.</div><div><br></div><div>We have a _left_ zero law for a monadplus:</div><div><br></div><div>mzero >>= f = mzero</div><div><br></div><div>but not a right one, just because of the existence of the function space in (>>=) that we can't see through</div><div><br>(do putStrLn "die"; mzero) /= mzero<br> </div><div>But nothing keeps us from seeing through an (*>) to count up something on the right. Control.Applicative.Backwards exists and would satisfy a "right zero" law if the original satisfied a left zero law.</div><div><br>Left Distribution:<br><br></div><div>Similarly, you can imagine a data type that is Alternative and also a Monad, but where<div><br></div><div><pre style="background:rgb(41,41,40);border:1px solid rgb(86,82,73);margin-top:0px;margin-bottom:0px;margin-left:1em;padding:0.3em;white-space:pre-wrap;line-height:1.3em;overflow:auto"><span class="gmail-nf" style="color:rgb(125,174,255);margin:0px;padding:0px">mplus</span> <span class="gmail-n" style="margin:0px;padding:0px">a</span> <span class="gmail-n" style="margin:0px;padding:0px">b</span> <span class="gmail-o" style="color:rgb(255,255,235);margin:0px;padding:0px">>>=</span> <span class="gmail-n" style="margin:0px;padding:0px">k</span> <span class="gmail-ow" style="color:rgb(220,112,255);margin:0px;padding:0px;font-weight:bold">=</span> <span class="gmail-n" style="margin:0px;padding:0px">mplus</span> <span class="gmail-p" style="margin:0px;padding:0px">(</span><span class="gmail-n" style="margin:0px;padding:0px">a</span> <span class="gmail-o" style="color:rgb(255,255,235);margin:0px;padding:0px">>>=</span> <span class="gmail-n" style="margin:0px;padding:0px">k</span><span class="gmail-p" style="margin:0px;padding:0px">)</span> <span class="gmail-p" style="margin:0px;padding:0px">(</span><span class="gmail-n" style="margin:0px;padding:0px">b</span> <span class="gmail-o" style="color:rgb(255,255,235);margin:0px;padding:0px">>>=</span> <span class="gmail-n" style="margin:0px;padding:0px">k</span><span class="gmail-p" style="margin:0px;padding:0px">)</span></pre><div><br></div><div>fails to hold in the left distributive style, and it also fails to be in the left catch style.</div></div><div><br></div></div><div>Without _retiring_ MonadPlus, we should at least use it consistently to imply the requirement of this sort of extra structure, even if it is ambiguous what that structure should be.</div><div><br></div><div>-Edward</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Apr 3, 2019 at 3:16 AM Fumiaki Kinoshita <<a href="mailto:fumiexcel@gmail.com">fumiexcel@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">I'm not quite sure what the point of MonadPlus is; the default definitions are the Alternative methods. Would we ever want to have MonadPlus different from Alternative?</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">2019年4月2日(火) 13:44 David Feuer <<a href="mailto:david.feuer@gmail.com" target="_blank">david.feuer@gmail.com</a>>:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="auto">I think the MonadPlus instance should probably have a MonadPlus constraint, since MonadPlus makes a sort of statement about the interaction between >>= and mplus, even if it's a bit of an ambiguous one.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Apr 2, 2019, 12:30 AM Fumiaki Kinoshita <<a href="mailto:fumiexcel@gmail.com" target="_blank">fumiexcel@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><div>This is another part of <a href="https://gitlab.haskell.org/ghc/ghc/merge_requests/644" rel="noreferrer" target="_blank">https://gitlab.haskell.org/ghc/ghc/merge_requests/644</a>, which is presumably much less controversial:<br class="gmail-m_-1446441370515002754gmail-m_2283829270033984104m_53381447158382037gmail-Apple-interchange-newline"><br></div><div>Generic (Kleisli m a b)</div><div><code><span class="gmail-m_-1446441370515002754gmail-m_2283829270033984104m_53381447158382037gmail-kt">Functor</span> <span class="gmail-m_-1446441370515002754gmail-m_2283829270033984104m_53381447158382037gmail-n">m</span> <span class="gmail-m_-1446441370515002754gmail-m_2283829270033984104m_53381447158382037gmail-o">=></span> <span class="gmail-m_-1446441370515002754gmail-m_2283829270033984104m_53381447158382037gmail-kt">Functor</span> <span class="gmail-m_-1446441370515002754gmail-m_2283829270033984104m_53381447158382037gmail-p">(</span><span class="gmail-m_-1446441370515002754gmail-m_2283829270033984104m_53381447158382037gmail-kt">Kleisli</span> <span class="gmail-m_-1446441370515002754gmail-m_2283829270033984104m_53381447158382037gmail-n">m</span> <span class="gmail-m_-1446441370515002754gmail-m_2283829270033984104m_53381447158382037gmail-n">a</span><span class="gmail-m_-1446441370515002754gmail-m_2283829270033984104m_53381447158382037gmail-p">)</span></code><br></div><div><code><span class="gmail-m_-1446441370515002754gmail-m_2283829270033984104m_53381447158382037gmail-p"><code><span class="gmail-m_-1446441370515002754gmail-m_2283829270033984104m_53381447158382037gmail-kt">Applicative</span> <span class="gmail-m_-1446441370515002754gmail-m_2283829270033984104m_53381447158382037gmail-n">m</span> <span class="gmail-m_-1446441370515002754gmail-m_2283829270033984104m_53381447158382037gmail-o">=></span> <span class="gmail-m_-1446441370515002754gmail-m_2283829270033984104m_53381447158382037gmail-kt">Applicative</span> <span class="gmail-m_-1446441370515002754gmail-m_2283829270033984104m_53381447158382037gmail-p">(</span><span class="gmail-m_-1446441370515002754gmail-m_2283829270033984104m_53381447158382037gmail-kt">Kleisli</span> <span class="gmail-m_-1446441370515002754gmail-m_2283829270033984104m_53381447158382037gmail-n">m</span> <span class="gmail-m_-1446441370515002754gmail-m_2283829270033984104m_53381447158382037gmail-n">a</span><span class="gmail-m_-1446441370515002754gmail-m_2283829270033984104m_53381447158382037gmail-p">)</span></code><br></span></code></div><div><code><span class="gmail-m_-1446441370515002754gmail-m_2283829270033984104m_53381447158382037gmail-p"><code><span class="gmail-m_-1446441370515002754gmail-m_2283829270033984104m_53381447158382037gmail-p"><code><span class="gmail-m_-1446441370515002754gmail-m_2283829270033984104m_53381447158382037gmail-kt">Alternative</span> <span class="gmail-m_-1446441370515002754gmail-m_2283829270033984104m_53381447158382037gmail-n">m</span> <span class="gmail-m_-1446441370515002754gmail-m_2283829270033984104m_53381447158382037gmail-o">=></span> <span class="gmail-m_-1446441370515002754gmail-m_2283829270033984104m_53381447158382037gmail-kt">Alternative</span> <span class="gmail-m_-1446441370515002754gmail-m_2283829270033984104m_53381447158382037gmail-p">(</span><span class="gmail-m_-1446441370515002754gmail-m_2283829270033984104m_53381447158382037gmail-kt">Kleisli</span> <span class="gmail-m_-1446441370515002754gmail-m_2283829270033984104m_53381447158382037gmail-n">m</span> <span class="gmail-m_-1446441370515002754gmail-m_2283829270033984104m_53381447158382037gmail-n">a</span><span class="gmail-m_-1446441370515002754gmail-m_2283829270033984104m_53381447158382037gmail-p">)</span></code><br></span></code></span></code></div><div><code><span class="gmail-m_-1446441370515002754gmail-m_2283829270033984104m_53381447158382037gmail-p"><code><span class="gmail-m_-1446441370515002754gmail-m_2283829270033984104m_53381447158382037gmail-p"><code><span class="gmail-m_-1446441370515002754gmail-m_2283829270033984104m_53381447158382037gmail-p"><code><span class="gmail-m_-1446441370515002754gmail-m_2283829270033984104m_53381447158382037gmail-kt">Monad</span> <span class="gmail-m_-1446441370515002754gmail-m_2283829270033984104m_53381447158382037gmail-n">m</span> <span class="gmail-m_-1446441370515002754gmail-m_2283829270033984104m_53381447158382037gmail-o">=></span> <span class="gmail-m_-1446441370515002754gmail-m_2283829270033984104m_53381447158382037gmail-kt">Monad</span> <span class="gmail-m_-1446441370515002754gmail-m_2283829270033984104m_53381447158382037gmail-p">(</span><span class="gmail-m_-1446441370515002754gmail-m_2283829270033984104m_53381447158382037gmail-kt">Kleisli</span> <span class="gmail-m_-1446441370515002754gmail-m_2283829270033984104m_53381447158382037gmail-n">m</span> <span class="gmail-m_-1446441370515002754gmail-m_2283829270033984104m_53381447158382037gmail-n">a</span><span class="gmail-m_-1446441370515002754gmail-m_2283829270033984104m_53381447158382037gmail-p">)</span></code><br></span></code></span></code></span></code></div><div><code><span class="gmail-m_-1446441370515002754gmail-m_2283829270033984104m_53381447158382037gmail-p"><code><span class="gmail-m_-1446441370515002754gmail-m_2283829270033984104m_53381447158382037gmail-p"><code><span class="gmail-m_-1446441370515002754gmail-m_2283829270033984104m_53381447158382037gmail-p"><code><span class="gmail-m_-1446441370515002754gmail-m_2283829270033984104m_53381447158382037gmail-p"><code><span class="gmail-m_-1446441370515002754gmail-m_2283829270033984104m_53381447158382037gmail-p">(</span><span class="gmail-m_-1446441370515002754gmail-m_2283829270033984104m_53381447158382037gmail-kt">Alternative</span> <span class="gmail-m_-1446441370515002754gmail-m_2283829270033984104m_53381447158382037gmail-n">m</span><span class="gmail-m_-1446441370515002754gmail-m_2283829270033984104m_53381447158382037gmail-p">,</span> <span class="gmail-m_-1446441370515002754gmail-m_2283829270033984104m_53381447158382037gmail-kt">Monad</span> <span class="gmail-m_-1446441370515002754gmail-m_2283829270033984104m_53381447158382037gmail-n">m</span><span class="gmail-m_-1446441370515002754gmail-m_2283829270033984104m_53381447158382037gmail-p">)</span> <span class="gmail-m_-1446441370515002754gmail-m_2283829270033984104m_53381447158382037gmail-o">=></span> <span class="gmail-m_-1446441370515002754gmail-m_2283829270033984104m_53381447158382037gmail-kt">MonadPlus</span> <span class="gmail-m_-1446441370515002754gmail-m_2283829270033984104m_53381447158382037gmail-p">(</span><span class="gmail-m_-1446441370515002754gmail-m_2283829270033984104m_53381447158382037gmail-kt">Kleisli</span> <span class="gmail-m_-1446441370515002754gmail-m_2283829270033984104m_53381447158382037gmail-n">m</span> <span class="gmail-m_-1446441370515002754gmail-m_2283829270033984104m_53381447158382037gmail-n">a</span><span class="gmail-m_-1446441370515002754gmail-m_2283829270033984104m_53381447158382037gmail-p">)</span></code></span></code></span></code></span></code></span></code></div></div></div>
_______________________________________________<br>
Libraries mailing list<br>
<a href="mailto:Libraries@haskell.org" rel="noreferrer" target="_blank">Libraries@haskell.org</a><br>
<a 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><br>
</blockquote></div>
</blockquote></div>
_______________________________________________<br>
Libraries mailing list<br>
<a href="mailto:Libraries@haskell.org" target="_blank">Libraries@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries</a><br>
</blockquote></div>