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