title: What’s an example of a Monad which is an Alternative but not a MonadPlus?
body: <p>In <a href="https://stackoverflow.com/a/10168111/237428">his answer</a> to the question <a href="https://stackoverflow.com/q/10167879/237428">“Distinction between typeclasses <code>MonadPlus</code>, <code>Alternative</code>, and <code>Monoid</code>?”</a>, Edward Kmett says that</p>
  
  <blockquote>
    <p>Moreover, even if <code>Applicative</code> was a superclass of <code>Monad</code>, you’d wind up needing the <code>MonadPlus</code> class anyways, because obeying</p>
  
  <pre><code>empty &lt;*&gt; m = empty
  </code></pre>
    
    <p>isn’t strictly enough to prove that</p>
  
  <pre><code>empty &gt;&gt;= f = empty
  </code></pre>
    
    <p>So claiming that something is a <code>MonadPlus</code> is stronger than claiming it is <code>Alternative</code>.</p>
  </blockquote>
  
  <p>It’s clear that any applicative functor which is <em>not</em> a monad is automatically an example of an <code>Alternative</code> which is not a <code>MonadPlus</code>, but Edward Kmett’s answer implies that there exists a <em>monad</em> which is an <code>Alternative</code> but not a <code>MonadPlus</code>: its <code>empty</code> and <code>&lt;|&gt;</code> would satisfy the <code>Alternative</code> laws,<sup>1</sup> but not the <code>MonadPlus</code> laws.<sup>2</sup>  I can’t come up with an example of this by myself; does anybody know of one?</p>
  
  <hr>
  
  <p><sup>1</sup> I wasn’t able to find a canonical reference for a set of <code>Alternative</code> laws, but I lay out what I believe them to be roughly halfway through <a href="https://stackoverflow.com/a/13081604/237428">my answer</a> to the question <a href="https://stackoverflow.com/q/13080606/237428">“Confused by the meaning of the <code>Alternative</code> type class and its relationship to other type classes”</a> (search for the phrase “right distributivity”).  The four laws I believe ought to hold are:</p>
  
  <ol>
  <li><strong>Right distributivity (of <code>&lt;*&gt;</code>):</strong>&nbsp;&nbsp;<code>(f &lt;|&gt; g) &lt;*&gt; a = (f &lt;*&gt; a) &lt;|&gt; (g &lt;*&gt; a)</code></li>
  <li><strong>Right absorption (for <code>&lt;*&gt;</code>):</strong>&nbsp;&nbsp;<code>empty &lt;*&gt; a = empty</code></li></li>
  <li><strong>Left distributivity (of <code>fmap</code>):</strong>&nbsp;&nbsp;<code>f &lt;$&gt; (a &lt;|&gt; b) = (f &lt;$&gt; a) &lt;|&gt; (f &lt;$&gt; b)</code></li>
  <li><strong>Left absorption (for <code>fmap</code>):</strong>&nbsp;&nbsp;<code>f &lt;$&gt; empty = empty</code></li></li>
  </ol>
  
  <p>I’d also happily accept being given a more useful set of <code>Alternative</code> laws.</p>
  
  <p><sup>2</sup> I know that <a href="http://www.haskell.org/haskellwiki/MonadPlus" rel="nofollow noreferrer">there’s some ambiguity about what the <code>MonadPlus</code> laws are</a>; I’m happy with an answer that uses left distribution or left catch, although I would weakly prefer the former.</p>