<div dir="ltr">On Tue, Apr 10, 2012 at 20:53,  <span dir="ltr">&lt;<a href="mailto:j.romildo@gmail.com">j.romildo@gmail.com</a>&gt;</span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">On Tue, Apr 10, 2012 at 02:16:15PM -0700, Tim Perry wrote:<br>
&gt; I believe that &quot;f 0 = ...&quot; is a guard and the guard is pattern matching on<br>
&gt; the constructor. Despite the fact that you don&#39;t have an instance of &quot;f _ =<br>
&gt; ....&quot;, the compiler needs an Eq instance to determine if it should run the<br>
&gt; &quot;f 0&quot; version of the function.<br>
&gt;<br>
&gt; Does that make sense? Hopefully someone with a better grasp of the topic<br>
&gt; will fill in the details.<br>
<br>
</div>I think you are using the wrong terms. The given examples does not make<br>
any use of guards. Guards are boolean expressions attached to the right<br>
</blockquote><div><br></div><div>It is using guards; you don&#39;t see them, because it&#39;s quietly translated by the compiler in the same way that `do` blocks are translated into applications of (&gt;&gt;=) and (&gt;&gt;) operators.</div>
<div><br></div><div>The reason for this is that numeric literals aren&#39;t actually literals; they are applications of the `fromInteger` function.  This is true even in patterns; therefore they can&#39;t actually be matched as patterns but are translated into guards.</div>
<div><br></div></div>-- <br>brandon s allbery                                      <a href="mailto:allbery.b@gmail.com" target="_blank">allbery.b@gmail.com</a><br>wandering unix systems administrator (available)     (412) 475-9364 vm/sms<br>
<br>
</div>