<br><div class="gmail_quote">On Thu, May 27, 2010 at 5:43 PM, David Menendez <span dir="ltr">&lt;<a href="mailto:dave@zednenem.com">dave@zednenem.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
On Thu, May 27, 2010 at 10:39 AM, Carlos Camarao<br>
<div class="im">&lt;<a href="mailto:carlos.camarao@gmail.com">carlos.camarao@gmail.com</a>&gt; wrote:<br>
</div>&gt; Isaac Dupree:<br>
<div><div></div><div class="h5">&gt;&gt; Your proposal appears to allow /incoherent/ instance selection.<br>
&gt;&gt; This means that an expression can be well-typed in one module, and<br>
&gt;&gt; well-typed in another module, but have different semantics in the<br>
&gt;&gt; two modules.  For example (drawing from above discussion) :<br>
&gt;&gt;<br>
&gt;&gt; module C where<br>
&gt;&gt;<br>
&gt;&gt; class F a b where f :: a -&gt; b<br>
&gt;&gt; class O a where o :: a<br>
&gt;&gt;<br>
&gt;&gt; module P where<br>
&gt;&gt; import C<br>
&gt;&gt;<br>
&gt;&gt; instance F Bool Bool where f = not<br>
&gt;&gt; instance O Bool where o = True<br>
&gt;&gt; k :: Bool<br>
&gt;&gt; k = f o<br>
&gt;&gt;<br>
&gt;&gt; module Q where<br>
&gt;&gt; import C<br>
&gt;&gt; instance F Int Bool where f = even<br>
&gt;&gt; instance O Int where o = 0<br>
&gt;&gt; k :: Bool<br>
&gt;&gt; k = f o<br>
&gt;&gt;<br>
&gt;&gt; module Main where<br>
&gt;&gt; import P<br>
&gt;&gt; import Q<br>
&gt;&gt; -- (here, all four instances are in scope)<br>
&gt;&gt; main = do { print P.k ; print Q.k }<br>
&gt;&gt; -- should result, according to your proposal, in<br>
&gt;&gt; -- False<br>
&gt;&gt; -- True<br>
&gt;&gt; -- , am I correct?<br>
&gt;<br>
&gt; If qualified importation of k from both P and from Q was specified, we<br>
&gt; would have two *distinct* terms, P.k and Q.k.<br>
<br>
</div></div>I think Isaac&#39;s point is that P.k and Q.k have the same definition (f<br>
o). If they don&#39;t produce the same value, then referential<br>
transparency is lost.<br>
<font color="#888888"><br>
--<br>
Dave Menendez &lt;<a href="mailto:dave@zednenem.com">dave@zednenem.com</a>&gt;<br>
&lt;<a href="http://www.eyrie.org/%7Ezednenem/" target="_blank">http://www.eyrie.org/~zednenem/</a>&gt;<br>
</font></blockquote></div><br>The definitions of P.k and Q.k are textually the same but the contexts are different. &quot;f&quot; and &quot;o&quot; denote distinct values in P and Q. Thus, P.k and Q.k don&#39;t have the same definition.<br>
<br>Thanks for the clarification. I thought the point was about coherence.<br><br>Cheers,<br><br>Carlos<br><br>