title: Pattern match(es) are non-exhaustive for Haskell function without `otherwise` clause
body: <p>Consider a function <code>disjoint :: (Eq a, Ord a) =&gt; [a] -&gt; [a] -&gt; Bool</code> which checks if there exists a common element between two sorted lists (and if it does, it returns <code>False</code> since they <em>wouldn't</em> be disjointed).</p>
  <pre class="lang-hs prettyprint-override"><code>disjoint :: (Eq a, Ord a) =&gt; [a] -&gt; [a] -&gt; Bool
  disjoint [] _ = True
  disjoint _ [] = True
  disjoint (x:xs) (y:ys)
    | x == y = False
    | x &lt; y = disjoint xs (y:ys)
    | x &gt; y = disjoint (x:xs) ys
  </code></pre>
  <p>In my IDE <code>vscode</code>, it yields the following warning:</p>
  <pre class="lang-none prettyprint-override"><code>Pattern match(es) are non-exhaustive
  In an equation for ‘disjoint’: Patterns not matched: (_:_) (_:_)compile(-Wincomplete-patterns)
  </code></pre>
  <p>Writing it in a different yet similar way, by using the <code>otherwise</code> clause, will yield no errors:</p>
  <pre class="lang-hs prettyprint-override"><code>disjoint :: (Eq a, Ord a) =&gt; [a] -&gt; [a] -&gt; Bool
  disjoint [] _ = True
  disjoint _ [] = True
  disjoint (x:xs) (y:ys)
    | x &lt; y = disjoint xs (y:ys)
    | x &gt; y = disjoint (x:xs) ys
    | otherwise = False
  </code></pre>
  <p>What &quot;pattern&quot; does the first code block &quot;miss&quot;? In other words, at what parameters will the first block of code have problems with?</p>