difference between isNothing and (== Nothing) in Haskell? : <p>I'm confused about why the two functions below involving <code>Nothing</code> are different:</p>

<pre><code>coalesce  m1 m2 = if  isNothing m1 then m2 else m1

coalesce' m1 m2 = if  (m1 == Nothing) then m2 else m1
</code></pre>

<p>The first one has type:</p>

<pre><code>λ&gt; :t coalesce
coalesce :: Maybe a -&gt; Maybe a -&gt; Maybe a
</code></pre>

<p>as expected. But the second one has:</p>

<pre><code>λ&gt; :t coalesce'
coalesce' :: Eq a =&gt; Maybe a -&gt; Maybe a -&gt; Maybe a
</code></pre>

<p>Why does using <code>(==Nothing)</code> introduce the <code>Eq a</code> constraint? </p>

<p>(GHC 8.2.2)</p>
