<div><font face="">Here&#39;s a test case for the problem I&#39;m having; I&#39;m using runhaskell from ghc v6.6.</font></div>
<div>&nbsp;</div>
<div>Problem #1) Without -fallow-undecidable-instances, I get the following error:</div>
<div><font face="courier new,monospace">&nbsp;&nbsp;&nbsp; Constraint is no smaller than the instance head<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; in the constraint: ConvertToInt a<br>&nbsp;&nbsp;&nbsp; (Use -fallow-undecidable-instances to permit this)<br>&nbsp;&nbsp;&nbsp; In the instance declaration for `ConvertToIntList a&#39; 
<br></font></div>
<div>Problem #2) With -fallow-undecidable-instances, I get this error instead:</div>
<div><font face="courier new,monospace">&nbsp;&nbsp;&nbsp; Overlapping instances for ConvertToIntList ()<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; arising from use of `convl&#39; at testcase.hs:28:6-15<br>&nbsp;&nbsp;&nbsp; Matching instances:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; instance (ConvertToInt a) =&gt; ConvertToIntList a 
<br>&nbsp;-- Defined at testcase.hs:15:0<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; instance ConvertToIntList () -- Defined at testcase.hs:18:0<br>&nbsp;&nbsp;&nbsp; In the expression: convl [()]<br>&nbsp;&nbsp;&nbsp; In the definition of `xl2&#39;: xl2 = convl [()]<br></font></div>
<div>I don&#39;t understand why there is an overlapping instances error; () is not an instance of ConvertToInt so how could that instance ever apply?</div>
<div>&nbsp;</div>
<div>Is there something basic about type-classes that I&#39;m not understanding here?&nbsp; My actual problem is more complicated than this, but this test-case covers the basic issue; something being an instance of class A means that I can derive an instance of class B for it, but I want to implement other instances of class B as well. 
</div>
<div>&nbsp;</div>
<div>Code below:</div>
<div><font face="courier new,monospace">
<div>
<div>{-# OPTIONS -fglasgow-exts -fallow-undecidable-instances #-}</div>
<div>&nbsp;</div>
<div>module&nbsp;TestCase</div>
<div>where</div>
<div>&nbsp;</div></div>class ConvertToInt a where<br>&nbsp;&nbsp; conv :: a -&gt; Int</font></div>
<div><font face="courier new,monospace">&nbsp;</font></div>
<div><font face="courier new,monospace">class ConvertToIntList a where<br>&nbsp;&nbsp; convl :: [a] -&gt; [Int]</font></div>
<div><font face="courier new,monospace">&nbsp;</font></div>
<div><font face="courier new,monospace">instance ConvertToInt Int where<br>&nbsp;&nbsp; conv = id</font></div>
<div><font face="courier new,monospace">&nbsp;</font></div>
<div><font face="courier new,monospace">instance ConvertToInt a =&gt; ConvertToIntList a where<br>&nbsp;&nbsp; convl = map conv</font></div>
<div><font face="courier new,monospace">&nbsp;</font></div>
<div><font face="courier new,monospace">instance ConvertToIntList () where<br>&nbsp;&nbsp; convl x = []</font></div>
<div><font face="courier new,monospace">&nbsp;</font></div>
<div><font face="courier new,monospace">x :: Int<br>x = 5</font></div>
<div><font face="courier new,monospace">&nbsp;</font></div>
<div><font face="courier new,monospace">xl :: [Int]<br>xl = convl [x]</font></div>
<div><font face="courier new,monospace">&nbsp;</font></div>
<div><font face="courier new,monospace">xl2 :: [Int]<br>xl2 = convl [()]</font></div>