Haskell type inference for lambda functions (in map)
<h3>Example 1</h3>

<p>Following definition without the type declaration will throw an error:</p>

<pre><code>f :: Eq t =&gt; (t,t) -&gt; Bool  -- omiting this line will result in an error
f = \(x,y) -&gt; x==y
</code></pre>

<p>(I know this function can be written shorter, but this is not the point here.)</p>

<h3>Example 2</h3>

<p>On the other hand using the <em>same</em> lambda function in a function using <code>map</code> does work without producing an error:</p>

<pre><code> g l = map (\(x,y) -&gt; x==y) l
</code></pre>

<p>(Just as an illustration: <code>g [(3,4),(5,5),(7,6)]</code> will produce <code>[False,True,False]</code></p>

<h3>Example 3</h3>

<p>Also following code is perfectly fine and it seems to do exactly the same as the original <code>f</code> from above. Here the type inference seems to work.</p>

<pre><code> f' (x,y) = x==y
</code></pre>

<h3>Question</h3>

<p>So my question is: Why do we need a type declaration in the first case, but not in the second and in the third?</p>