[Haskell-cafe] yaml and aeson Was: Growing Haskell Platform

Michael Snoyman michael at snoyman.com
Fri Dec 7 11:24:59 CET 2012


On Fri, Dec 7, 2012 at 12:00 PM, Roman Cheplyaka <roma at ro-che.info> wrote:

> * Michael Snoyman <michael at snoyman.com> [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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20121207/779cd851/attachment.htm>


More information about the Haskell-Cafe mailing list