<div dir="ltr">Ross Paterson wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="Ih2E3d">On Fri, Aug 15, 2008 at 03:09:16PM +0200, Sean Leather wrote:<br>

&gt; Ross Paterson wrote:<br>
&gt; &nbsp; &nbsp; With implicit import, it just doesn&#39;t work to have different instances in<br>
&gt; &nbsp; &nbsp; different places. &nbsp;Suppose two modules use your library in the different<br>
&gt; &nbsp; &nbsp; ways you envisage. &nbsp;Then those modules cannot be used together in the<br>
&gt; &nbsp; &nbsp; same program. &nbsp;Your library will not be re-usable.<br>
&gt;<br>
&gt; It is not true that those modules cannot be used in the same program. It is<br>
&gt; possibly true that they cannot both be imported by another module. (It depends<br>
&gt; on how the instances are used.)<br>
<br>
</div>If they&#39;re in the same program, there will be chains of imports from Main<br>
to each of them, so Main will implicitly import conflicting instances and<br>
will be rejected by the compiler.<br>
<div><div></div><div class="Wj3C7c"></div></div></blockquote><div><br>module A where<br>class A t where<br>&nbsp; a :: t<br><br>module B where<br>import A<br>instance A Int where<br>&nbsp; a = 0<br>a0 :: Int<br>a0 = a<br><br>module C where<br>
import A<br>instance A Int where<br>&nbsp; a = 1<br>a1 :: Int<br>a1 = a<br><br>module Main where<br>import A<br>import B<br>import C<br>main = do putStrLn $ &quot;a0=&quot; ++ show a0<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; putStrLn $ &quot;a1=&quot; ++ show a1<br>
<br>This works, because of the way the instances are used. While overlapping instances are imported into Main, they are not used in Main.<br><br>Sean<br></div></div></div>