title: Why the difference in type-inference over the as-pattern in two similar function definitions?
body: <p>I have the following two similar function definitions:</p>
  
  <pre><code>left f (Left x) = Left (f x)
  left _ (Right x) = Right x
  
  left' f (Left x) = Left (f x)
  left' _ r@(Right _) = r
  </code></pre>
  
  <p>When I check the type signatures of the two functions, I am confused by the following types:</p>
  
  <pre><code>ghci&gt; :t left
  left :: (t -&gt; a) -&gt; Either t b -&gt; Either a b
  ghci&gt; :t left'
  left' :: (a -&gt; a) -&gt; Either a b -&gt; Either a b
  </code></pre>
  
  <p>I suppose <code>left</code> and <code>left'</code> should be of the same type signature, but the haskell's type inference gives me a suprise. </p>
  
  <p>I can't figure out why the type signatures of <code>left</code> and <code>left'</code> are different. Can anybody give me some information? Thanks!</p>