<br><font size=2><tt><br>
Christian Maeder wrote:</tt></font>
<br><font size=2><tt>&gt; Jared Updike wrote:<br>
&gt; &gt; http://www.haskell.org/onlinereport/decls.html#default-decls<br>
&gt; &gt; http://www.haskell.org/tutorial/numbers.html#sect10.4<br>
&gt; <br>
&gt; I still don't see, why it works for show but not for my_show.<br>
&gt; <br>
&gt; &gt; On 1/12/06, Jeff.Harper@handheld.com &lt;Jeff.Harper@handheld.com&gt;
wrote:<br>
&gt; [...]<br>
&gt; &gt;&gt; class (Show a) =&gt; My_show a where<br>
&gt; &gt;&gt; &nbsp; &nbsp;my_show :: a -&gt; String<br>
&gt; <br>
&gt; If I let this be<br>
&gt; <br>
&gt; &nbsp; &nbsp;class My_show a where<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp;my_show :: a -&gt; String<br>
&gt; <br>
&gt; &gt;&gt; instance My_show Int where<br>
&gt; &gt;&gt; &nbsp; &nbsp;my_show a = show a ++ &quot; :: Int&quot;<br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt; instance My_show Integer where<br>
&gt; &gt;&gt; &nbsp; &nbsp;my_show a = show a ++ &quot; :: Integer&quot;<br>
&gt; <br>
&gt; What is the difference to the builtin Show class?<br>
</tt></font>
<br><font size=2><tt>I was wondering the same thing myself. &nbsp;Then,
I reread the online Haskell report link. </tt></font>
<br>
<br><font size=2><tt>From http://www.haskell.org/onlinereport/decls.html#default-decls:</tt></font>
<br><font size=2><tt>where n&gt;=0, and each ti must be a type for which
Num ti holds. In situations where an ambiguous type is discovered, an ambiguous
type variable, v, is defaultable if: </tt></font>
<br><font size=2><tt>&nbsp; &nbsp; &nbsp;o v appears only in constraints
of the form C v, where C is a class, and </tt></font>
<br><font size=2><tt>&nbsp; &nbsp; &nbsp;o at least one of these classes
is a numeric class, (that is, Num or a subclass of Num), and </tt></font>
<br><font size=2><tt>&nbsp; &nbsp; &nbsp;o all of these classes are defined
in the Prelude or a standard library (Figures 6.2--6.3, pages -- show the
numeric classes, and Figure 6.1, page , shows the classes defined in the
Prelude.) <br>
<br>
Notice the last bullet item. &nbsp;class Show is part of the Prelude. &nbsp;However,
class My_show is not part of the prelude. &nbsp;AS far as I can tell, that's
the only reason &quot;my_show 1&quot; produces errors while &quot;show
1&quot; is okay. &nbsp;</tt></font>