Hi. I came a cross the following phenomena which, at least to me, occurs kind<br>
of awkward. The code below :<br>
<br>
data MyData a&nbsp; where<br>
&nbsp; DC1 :: (Show a ) =&gt; a -&gt; MyData a<br>
&nbsp; <br>
instance Show (MyData a) where<br>
&nbsp; show (DC1 a ) = show a<br>
<br>
yields the ghci error : &nbsp;<br>
'Could not deduce (Show a) from the context (Show (MyData a))'<br>
<br>
Adding a Show restriction for the instantiation as in<br>
<br>
instance Show a =&gt; Show (MyData a ) where<br>
&nbsp; show (DC1 a ) = show a<br>
<br>
makes the type checker happy. However,&nbsp; this means that all
parametrised values over MyData must have a Show type which isn't
necessarily what one wants.<br>
<br>
I would also like to point out that adding a 'wrapper type' as in<br>
<br>
data Wrap a = Wrap a<br>
<br>
data MyData a&nbsp; where<br>
&nbsp; DC1 :: (Show a ) =&gt; a -&gt; MyData (Wrap a)<br>
<br>
instance Show (MyData a ) where<br>
&nbsp; show (DC1 a ) = show a &nbsp;<br>
<br>
works fine. Even though 'Wrap' does not derive Show.<br>
<br>
So, if anyone can give me some hints about the reason for this,&nbsp; I will appreciate it :)<br>
<br>
Thanks<br>
/Joel