Yes, or better:<br><br>gshow' :: Data a => a -> String<br>gshow' t = fromMaybe (showConstr(toConstr t)) (cast t)<br><br>(which gets rid of the parentheses around numbers).<br><br>Still doesnt get a deserialize though ;-)
<br><br><div><span class="gmail_quote">On 6/24/07, <b class="gmail_sendername">Andrea Vezzosi</b> <<a href="mailto:sanzhiyan@gmail.com">sanzhiyan@gmail.com</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
As a side note i'd like to point out that introspectData has a problem with constructors containing Strings because show (x::String) /= x:<br><br>data Foo = Foo { bar :: String } deriving (Typeable,Data)<br><br>introspectData (Foo "quux") --> [("bar","\"quux\"")]
<br><br>Those extras \" don't look very nice in the xml.. (the output of introspectData is also wrong in the article's example )<br>you should probably use a modified gshow:<br><br>gshow' :: Data a => a -> String
<br>gshow' x = fromMaybe (gshow x) (cast x)<br><br>which is id for Strings.<br><br><br><br>
</blockquote></div><br>