<div>Actually, it looks like a dirty technological impedence.</div><div><br></div><div>Haskell makes functions first class values, but still data values are easier to handle than functions, since their type can implement the Eq typeclass, thanks to constructor matches.</div>
<div><br></div><div><br></div><div>While I got your point, I&#39;m still  wondering about functions as constructor of other functions thus it would be possible to match to the function name like we do for type constructors.</div>
<div>I can&#39;t have an insight about why this is wrong. Why can&#39;t we treat functions as constructors?</div><div><br></div><div><br></div><div>The point, I guess, is that this would assign a kind of &quot;identity&quot; to morphisms that belong to a category. I see how this might be wrong: functions can be equivalent exactly like integers, but they are just harder to implement.</div>
<div><br></div><div>Thus we are back to the dirty technical problem of evaluating function equivalence.</div><div><br></div><div><br></div><div>Giacomo</div><br><div class="gmail_quote">On Mon, Dec 12, 2011 at 2:27 AM, Felipe Almeida Lessa <span dir="ltr">&lt;<a href="mailto:felipe.lessa@gmail.com">felipe.lessa@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"><div class="im">On Sun, Dec 11, 2011 at 8:09 PM, Graham Gill &lt;<a href="mailto:math.simplex@gmail.com">math.simplex@gmail.com</a>&gt; wrote:<br>

&gt; Excellent, thanks Daniel and Felipe.<br>
&gt;<br>
&gt; We don&#39;t even need to invoke infinite or undecidable problems, since it&#39;s<br>
&gt; easy to construct equal functions for which determining equality would be<br>
&gt; prohibitively expensive. If then you can only check equality for some<br>
&gt; functions, because you want compilation to finish, say, within the<br>
&gt; programmer&#39;s lifetime, you lose referential transparency.<br>
<br>
</div>Note that the time isn&#39;t spent on compilation time, but on run time!<br>
Which is actually worse ;-).<br>
<br>
Also note that it is possible to imagine something like<br>
<br>
  obviouslyEqual :: a -&gt; a -&gt; Bool<br>
<br>
where &#39;obviouslyEqual x y&#39; is &#39;True&#39; when it&#39;s easy to see that they<br>
are equal or &#39;False&#39; if you can&#39;t decide.  Actually, with GHC you may<br>
say<br>
<br>
  {-# LANGUAGE MagicHash #-}<br>
<br>
  import GHC.Exts<br>
<br>
  obviouslyEqual :: a -&gt; a -&gt; Bool<br>
  obviouslyEqual a b =<br>
    case I# (reallyUnsafePtrEquality# a b) of<br>
      0 -&gt; False<br>
      _ -&gt; True<br>
<br>
However, this functions is *not* referentially transparent (exercise:<br>
show an example of how obviouslyEqual breaks referential<br>
transparency).  reallyUnsafePtrEquality# is really unsafe for a reason<br>
=).<br>
<br>
Cheers,<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
Felipe.<br>
</font></span><div class="HOEnZb"><div class="h5"><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>
</div></div></blockquote></div><br>