I believe that &quot;f 0 = ...&quot; is a guard and the guard is pattern matching on the constructor. Despite the fact that you don&#39;t have an instance of &quot;f _ = ....&quot;, the compiler needs an Eq instance to determine if it should run the &quot;f 0&quot; version of the function.<div>
<br>Does that make sense? Hopefully someone with a better grasp of the topic will fill in the details.</div><div><br></div><div>--Tim<br><br><div class="gmail_quote">On Tue, Apr 10, 2012 at 12:57 PM,  <span dir="ltr">&lt;<a href="mailto:j.romildo@gmail.com">j.romildo@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello.<br>
<br>
Given the following function definitions<br>
<br>
   f 0 = True<br>
<br>
   g False = True<br>
<br>
ghc infers the following types for the functions:<br>
<br>
   f :: (Eq a, Num a) =&gt; a -&gt; Bool<br>
   g :: Bool -&gt; Bool<br>
<br>
Why f has &quot;Eq a&quot; in the context in ts type, and g does not?<br>
<br>
As both are defined using a constant pattern, I expected none of them<br>
should require the type of the argument to be instance of Eq.<br>
<br>
Romildo<br>
<br>
_______________________________________________<br>
Beginners mailing list<br>
<a href="mailto:Beginners@haskell.org">Beginners@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/beginners" target="_blank">http://www.haskell.org/mailman/listinfo/beginners</a><br>
</blockquote></div><br></div>