title: Why does type inference for lambda differ from standard declaration?
body: <p>In GHCI, if I use <code>:t</code> on each of the below functions, they differ.</p>
  <p><code>:t test</code> gives <code>(Ord p, Num p) =&gt; p -&gt; p -&gt; p</code></p>
  <p><code>:t testAsLambda</code> gives <code>Integer -&gt; Integer -&gt; Integer</code></p>
  <p>Why does using a lambda to define the exact same function cause more restrictive type inference?</p>
  <p>I understand that it might be silly to declare a named function as a lambda like this; I'm just trying to reason about Haskell's type inference here.</p>
  <pre><code>test x y =
    let d = y - x in
     if d &gt; 0 then d
     else 0
  
  testAsLambda = 
    (\x y -&gt; 
     let d = y - x in
      if d &gt; 0 then d
      else 0)
  </code></pre>