title: What does Haskell's <|> operator do?
body: <p>Going through Haskell's documentation is always a bit of a pain for me, because all the information you get about a function is often nothing more than just: <code>f a -&gt; f [a]</code> which could mean any number of things.</p>
  
  <p>As is the case of the <code>&lt;|&gt;</code> function.</p>
  
  <p>All I'm given is this: <code>(&lt;|&gt;) :: f a -&gt; f a -&gt; f a</code> and that it's an <em>"associative binary operation"</em>...</p>
  
  <p>Upon inspection of <code>Control.Applicative</code> I learn that it does seemingly unrelated things depending on implementation.</p>
  
  <pre><code>instance Alternative Maybe where
      empty = Nothing
      Nothing &lt;|&gt; r = r
      l       &lt;|&gt; _ = l
  </code></pre>
  
  <p>Ok, so it returns right if there is no left, otherwise it returns left, gotcha.. This leads me to believe it's a "left or right" operator, which kinda makes sense given its use of <code>|</code> and <code>|</code>'s historical use as "OR"</p>
  
  <pre><code>instance Alternative [] where
      empty = []
      (&lt;|&gt;) = (++)
  </code></pre>
  
  <p>Except here it just calls list's concatenation operator... Breaking my idea down...</p>
  
  <p>So what exactly is that function? What's its use? Where does it fit in in the grand scheme of things?</p>