views:

127

answers:

1

Is there any XML-(de)serializer for Haskell using Data/Typeable with functions similar to

toXml :: Data d => d -> XmlValue
fromXml :: Data d => String -> Result d

in the spirit of Text.JSON.Generic?

+1  A: 

Please check this TypLAB article—it uses generic programming (multirec rather than SYB) to convert from and to XML.

Martijn
finnsson
@finnsson almost everything can still be derived automatically. Instead of one line "deriving (Data, Typeable)" for SYB, you'll have to write 4 lines for multirec (See the last code block in the typLAB article). Slightly more verbose, but still manageable I'd say.
Tom Lokhorst
@Tom do you know if there's any json-lib using multirec?
finnsson
Hi finnsson, just to make sure, it's no problem if you use several generic programming libraries. You don't need to do any generic programming to use generic functions. So I'd say: go for SYB JSON and MultiRec XML.
Martijn
I'll go with the SYB/MultiRec-solution for now and see if I can either write a MultiRec-solution for JSON or a SYB-solution for XML later on.
finnsson