Hello, cafe! I made a package xml-conduit-generic<https://github.com/odr/xml-conduit-generic> to provide conversion from ADT to xml and vice versa. Conversion works as Conduit (ToXml) or Consumer (FromXml). Example: data T4 = T4 {v4 :: Int, n4 :: Maybe T4} deriving (Eq, Show, Generic) instance ToXml T4 instance FromXml T4
runToXml $ T4 5 $ Just $ T4 6 Nothing "<T4 v4=\"5\"><n4 v4=\"6\"/></T4>"
runFromXml $ "<T4 v4=\"5\"><n4 v4=\"6\"/></T4>" :: IO (Either String T4) Right $ T4 5 $ Just $ T4 6 Nothing
It would be great if someone look to the version on github and give me some notes. Then I am going to put it on hackage. Unfortunately, I didn't find a way to avoid OverlappingInstances (for GFromXml class). Any ideas are welcome. Best regards, Dmitry