通过泛型将数据类型转换为 xml?

Convert data type to xml via generics?

有没有可以通过泛型将数据类型转换为 xml 的库?基本上像 Data.Aeson 但对于 XML。或者以某种通用方式将 Data.Aeson.Value 转换为 xml 的函数?

如果不存在,您将如何手动将自定义数据类型转换为 xml?我的大部分谷歌搜索都在向我展示如何从 XML 转换,而不是向它转换。

我想 https://github.com/finnsson/Text.XML.Generic 就是您要找的。它也在 hackage 中,它被称为 text-xml-generic

我找到了 tofromxml, which also solves the problem. It's a little newer and has a few more downloads than text-xml-generic,但除此之外它们看起来都有效。