If you just wanted the constructor name, show would have worked perfectly.<br><br><div>On Sun Jan 12 2014 at 15:45:28, Gareth Morgan <<a href="mailto:gmorgan1984@gmail.com">gmorgan1984@gmail.com</a>> wrote:</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">Data.Typeable with Data.Data worked. Thank you.<div><br></div><div>Using Typeable alone was only giving me the type of the whole type. Data.Data had the toConstr function needed to give me the particular constructor name.</div>

<div><br></div><div>For reference if anyone is interested in the solution:</div><div><br></div><div><div>import Data.Typeable</div><div>import Data.Data</div></div><div><br></div><div>data A  = A | B | C deriving (Typeable, Data)</div>

<div><br></div><div><div>typeName :: A -> String</div><div>typeName = show . toConstr</div></div><div><br></div><div><br></div><div>I needed to add DeriveDataTypeable extension to my cabal file</div>
<div><br><br><div></div></div></div><div dir="ltr"><div><div>On Sun, Jan 12, 2014 at 2:53 PM, Brandon Allbery <span dir="ltr"><<a href="mailto:allbery.b@gmail.com" target="_blank">allbery.b@gmail.com</a>></span> wrote:<br>

</div></div></div><blockquote style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div><div><div dir="ltr"><div><div>
<div>On Sun, Jan 12, 2014 at 9:47 AM, Gareth Morgan <span dir="ltr"><<a href="mailto:gmorgan1984@gmail.com" target="_blank">gmorgan1984@gmail.com</a>></span> wrote:<br>
<blockquote style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">Won't show include all the components? I wanted to include only the type name.</div>

</blockquote><div>
<br></div></div><div>Types only exist at compile time normally. But if you add a Typeable constraint (see Data.Typeable and the DeriveDataTypeable extension) you can get type names at runtime.</div><span><font color="#888888"><div>

<br></div></font></span></div><span><font color="#888888">-- <br><div dir="ltr">
<div>brandon s allbery kf8nh                               sine nomine associates</div><div><a href="mailto:allbery.b@gmail.com" target="_blank">allbery.b@gmail.com</a>                                  <a href="mailto:ballbery@sinenomine.net" target="_blank">ballbery@sinenomine.net</a></div>


<div>unix, openafs, kerberos, infrastructure, xmonad        <a href="http://sinenomine.net" target="_blank">http://sinenomine.net</a></div></div>
</font></span></div></div>
<br></div></div></div></blockquote><blockquote style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div><div>_______________________________________________<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/mailman/listinfo/beginners</a><br>
<br></div></div></div></blockquote></blockquote>