<div dir="ltr"><div>Well I meant it as (<span style="font-family:comic sans ms,sans-serif">gmapQ show) thing</span> and in the meantime I found out that I need to replace show with <span style="font-family:comic sans ms,sans-serif">gshow</span>, and AFAICT, type classes are incompatible with generic stuff.<br>
<br></div><div>Adrian.<br><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On 13 July 2013 19:27, Dilawar Singh <span dir="ltr">&lt;<a href="mailto:dilawars@iitb.ac.in" target="_blank">dilawars@iitb.ac.in</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Comment out the last line (main = etc...) and do this in ghci,<br>
  :t (show thing)<br>
<br>
Type of (show thing) is String. This is input to gmapQ function which has<br>
following type.<br>
<br>
  :t gmapQ   gmapQ :: Data a =&gt; (forall d. Data d =&gt; d -&gt; u) -&gt; a -&gt; [u]<br>
<br>
First argument to this function has the type (d -&gt; u). Surely, this can&#39;t be String.<br>
<br>
--<br>
Dilawar EE, IITB <br><div><div class="h5">
On Sat, Jul 13, 2013 at 04:48:49PM +0800, Adrian May wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi All,<br>
<br>
I got this far:<br>
<br>
{-# LANGUAGE OverloadedStrings #-}<br>
{-# LANGUAGE DeriveDataTypeable #-}<br>
import Data.Text<br>
import Data.Typeable<br>
import Data.Data<br>
<br>
data Thing = Thing { foo :: Int, bar :: String}<br>
  deriving (Read, Show, Typeable, Data)<br>
thing :: Thing<br>
thing = Thing 1 &quot;wop&quot;<br>
con = toConstr thing<br>
fields = constrFields con<br>
main = putStrLn $ show con ++ show fields ++ ( Prelude.concat $ gmapQ show<br>
thing )<br>
<br>
But it&#39;s barfing like this:<br>
<br>
   Could not deduce (Show d) arising from a use of `show&#39;<br>
   from the context (Data d)<br>
     bound by a type expected by the context: Data d =&gt; d -&gt; [Char]<br>
     at w.hs:76:65-80<br>
<br>
I can see why, but not how to fix it.<br>
<br>
Any help much appreciated,<br>
Adrian.<br>
</blockquote>
<br>
</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
______________________________<u></u>_________________<br>
Beginners mailing list<br>
<a href="mailto:Beginners@haskell.org" target="_blank">Beginners@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/beginners" target="_blank">http://www.haskell.org/<u></u>mailman/listinfo/beginners</a><br>
</blockquote>
<br>
<br>
______________________________<u></u>_________________<br>
Beginners mailing list<br>
<a href="mailto:Beginners@haskell.org" target="_blank">Beginners@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/beginners" target="_blank">http://www.haskell.org/<u></u>mailman/listinfo/beginners</a><br>
</blockquote></div><br></div>