[Haskell-cafe] XmlSerializer.deserialize?

Hugh Perkins hughperkins at gmail.com
Sun Jun 24 17:34:34 EDT 2007


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 at 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.
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20070624/79383001/attachment.htm


More information about the Haskell-Cafe mailing list