
On Fri, Dec 7, 2012 at 12:00 PM, Roman Cheplyaka
* Michael Snoyman
[2012-12-07 11:51:40+0200] As for toYAML/toJSON, I guess most of the time they are different anyway — otherwise it's defeating the purpose of YAML to be more human-readable than JSON.
I don't think that's true in practice. Most of the readability of YAML comes from the syntax, not the choice of actual serialization structure. But I could be mistaken.
Not the serialization structure, no.
I meant that YAML has some flexibility in syntax, which probably should be exploited by the instance writer to improve readability.
For that you'd need a sufficiently adjustable pretty-printer, but that also means that you can't reuse ToJSON.
Roman
I see what you mean. You're talking about pretty-printing features such as how strings get quoted. That's true, to have full support for this, you can't use the ToJSON interface, but instead need to use the Text.Libyaml low-level interface. IMO, that's an acceptable trade-off. I consider the readability of YAML much more important for human-generated files. But if you'd like to see a higher-level interface which allows more control, I see no problem with adding it in. Michael