title: Is `data PoE a = Empty | Pair a a` a monad?
body: <p>This question comes from this answer in
  <a href="https://stackoverflow.com/a/49703783/412549">example of a functor that is Applicative but not a Monad</a>:
  It is claimed that the</p>
  
  <pre><code>data PoE a = Empty | Pair a a deriving (Functor,Eq)
  </code></pre>
  
  <p>cannot have a monad instance, but I fail to see that with:</p>
  
  <pre><code>instance Applicative PoE where
      pure x = Pair x x
      Pair f g &lt;*&gt; Pair x y = Pair (f x) (g y)
      _        &lt;*&gt; _        = Empty
  instance Monad PoE where
      Empty    &gt;&gt;= _ = Empty
      Pair x y &gt;&gt;= f = case (f x, f y) of 
                         (Pair x' _,Pair _ y') -&gt; Pair x' y'
                         _ -&gt; Empty
  </code></pre>
  
  <p>The actual reason why I believe this to be a monad is that it is isomorphic to <code>Maybe (Pair a)</code> with <code>Pair a = P a a</code>. They are both monads, both traversables so their composition should form a monad, too. <a href="https://stackoverflow.com/q/42284879/2751851">Oh, I just found out not always</a>.</p>
  
  <p>Which counter-example failes which monad law? (and how to find that out systematically?)</p>
  
  <hr>
  
  <p><em>edit:</em> I did not expect such an interest in this question. Now I have to make up my mind if I accept the best example or the best answer to the "systematically" part.</p>
  
  <p>Meanwhile, I want to visualize how <code>join</code> works for the simpler <code>Pair a = P a a</code>:</p>
  
  <pre><code>                   P
            ________/ \________
           /                   \
          P                     P
         / \                   / \
        1   2                 3   4
  </code></pre>
  
  <p>it always take the outer path, yielding <code>P 1 4</code>, more commonly known as a diagonal in a matrix representation. For monad associativy I need three dimensions, a tree visualization works better. Taken from chi's answer, this is the failing example for join, and how I can comprehend it.</p>
  
  <pre><code>                  Pair
            _________/\_________
           /                    \
         Pair                   Pair
          /\                     /\
         /  \                   /  \
      Pair  Empty           Empty  Pair
       /\                           /\
      1  2                         3  4
  </code></pre>
  
  <p>Now you do the <code>join . fmap join</code> by collapsing the lower levels first, for <code>join . join</code> collapse from the root.</p>