<br>Is haskell supposed to always infer the most general type (barring extensions)?<br><br>I found a simple case where this is not true:<br><br>f _ = undefined<br>  where<br>    _ = y :: Int -&gt; Int<br><br>y x = undefined<br>
  where<br>    _ = f x<br><br>Haskell infers the types of &#39;y&#39; and &#39;f&#39; as:<br>f :: Int -&gt; a<br>y :: Int -&gt; Int<br><br>This confused me at first, but after thinking about it a while it seemed to make sense. But then my friend John pointed out that you can add type sigs for &#39;f&#39; and &#39;y&#39;:<br>
f :: a -&gt; b<br>
y :: a -&gt; b<br>and have it still typecheck!<br><br>This thoroughly confused me. <br><br>Why does haskell not infer the most general type for these functions? Is it a limitation of the algorithm? a limitation of the recursive let binding?<br>
<br>Any insight would be appreciated :)<br><br>- Job<br><br>