Hi,<div><br></div><div>Now, for the following datatype:</div><div><br></div><div><font face="&#39;courier new&#39;, monospace">data X a = X { myX :: a } deriving Generic</font></div><div><br></div>
<div>You get the following -ddump-deriv output:</div><div><br></div><div><div><font face="&#39;courier new&#39;, monospace">==================== Derived instances ====================</font></div>
<div><font face="&#39;courier new&#39;, monospace">Derived instances:</font></div><div><font face="&#39;courier new&#39;, monospace">  instance GHC.Generics.Generic (Temp.X a_adY) where</font></div>
<div><font face="&#39;courier new&#39;, monospace">    GHC.Generics.from (Temp.X g1_aeG)</font></div><div><font face="&#39;courier new&#39;, monospace">      = GHC.Generics.M1</font></div>
<div><font face="&#39;courier new&#39;, monospace">          (GHC.Generics.M1 (GHC.Generics.M1 (GHC.Generics.K1 g1_aeG)))</font></div><div><font face="&#39;courier new&#39;, monospace">    <a href="http://GHC.Generics.to" target="_blank">GHC.Generics.to</a></font></div>


<div><font face="&#39;courier new&#39;, monospace">      (GHC.Generics.M1 (GHC.Generics.M1 (GHC.Generics.M1 (GHC.Generics.K1 g1_aeH))))</font></div><div><font face="&#39;courier new&#39;, monospace">      = Temp.X g1_aeH</font></div>


<div><font face="&#39;courier new&#39;, monospace">  </font></div><div><font face="&#39;courier new&#39;, monospace">  instance GHC.Generics.Datatype Temp.D1X where</font></div>
<div><font face="&#39;courier new&#39;, monospace">    GHC.Generics.datatypeName _ = &quot;X&quot;</font></div><div><font face="&#39;courier new&#39;, monospace">    GHC.Generics.moduleName _ = &quot;Temp&quot;</font></div>


<div><font face="&#39;courier new&#39;, monospace">  </font></div><div><font face="&#39;courier new&#39;, monospace">  instance GHC.Generics.Constructor Temp.C1_0X where</font></div>
<div><font face="&#39;courier new&#39;, monospace">    GHC.Generics.conName _ = &quot;X&quot;</font></div><div><font face="&#39;courier new&#39;, monospace">    GHC.Generics.conIsRecord _ = GHC.Types.True</font></div>
<div><font face="&#39;courier new&#39;, monospace">  </font></div><div><font face="&#39;courier new&#39;, monospace">  instance GHC.Generics.Selector Temp.S1_0_0X where</font></div>
<div><font face="&#39;courier new&#39;, monospace">    GHC.Generics.selName _ = &quot;myX&quot;</font></div><div><font face="&#39;courier new&#39;, monospace">  </font></div>
<div><font face="&#39;courier new&#39;, monospace"><br></font></div><div><font face="&#39;courier new&#39;, monospace">Generic representation:</font></div><div><font face="&#39;courier new&#39;, monospace">  </font></div>


<div><font face="&#39;courier new&#39;, monospace">  Generated datatypes for meta-information:</font></div><div><font face="&#39;courier new&#39;, monospace">    Temp.D1X</font></div>
<div><font face="&#39;courier new&#39;, monospace">    Temp.C1_0X</font></div><div><font face="&#39;courier new&#39;, monospace">    Temp.S1_0_0X</font></div><div><font face="&#39;courier new&#39;, monospace">  </font></div>


<div><font face="&#39;courier new&#39;, monospace">  Representation types:</font></div><div><font face="&#39;courier new&#39;, monospace">    Temp.Rep_X = GHC.Generics.D1</font></div>
<div><font face="&#39;courier new&#39;, monospace">                   Temp.D1X</font></div><div><font face="&#39;courier new&#39;, monospace">                   (GHC.Generics.C1</font></div>
<div><font face="&#39;courier new&#39;, monospace">                      Temp.C1_0X</font></div><div><font face="&#39;courier new&#39;, monospace">                      (GHC.Generics.S1 Temp.S1_0_0X (GHC.Generics.Par0 a_adY)))</font></div>


<div><br></div><div>Still not perfect, in that the representation type should really appear as a type instance inside the Generic instance, but at least all the important information is printed.</div><div><br></div><div>

<br>
</div><div>Cheers,</div><div>Pedro</div><div><br></div><br><div class="gmail_quote">2011/11/3 Bas van Dijk <span dir="ltr">&lt;<a href="mailto:v.dijk.bas@gmail.com" target="_blank">v.dijk.bas@gmail.com</a>&gt;</span><br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
2011/11/3 José Pedro Magalhães &lt;<a href="mailto:jpm@cs.uu.nl" target="_blank">jpm@cs.uu.nl</a>&gt;:<br>
<div>&gt; &quot;-ddump-deriv&quot; will print (most of) it.<br>
<br>
</div>But it doesn&#39;t print the most useful piece of information: the<br>
definition of Rep.<br>
<br>
It would be great if this could be added.<br>
<br>
Currently when I have a type that I want to know the Rep of, say:<br>
<br>
data Foo = Bar Int<br>
         | Boo {hello :: String}<br>
           deriving Generic<br>
<br>
I just convert it to a Rep and show it:<br>
<br>
err = show $ from $ Boo &quot;World&quot;<br>
<br>
However Reps don&#39;t have Show instances so GHC complains:<br>
<br>
No instance for<br>
  (Show (D1 D1Foo (   C1 C1_0Foo (S1 NoSelector (Rec0 Int))<br>
                  :+: C1 C1_1Foo (S1 S1_1_0Foo (Rec0 String))<br>
                  )<br>
         x0<br>
        )<br>
  )<br>
  arising from a use of `show&#39;<br>
<br>
And there you go. This is the only time when I&#39;m happy to see an error<br>
message :-)<br>
<span><font color="#888888"><br>
Bas<br>
</font></span></blockquote></div><br></div>