[Haskell-cafe] A new yaml module
michael at snoyman.com
Mon Feb 3 08:57:28 UTC 2014
The yaml package currently provides two modules. Text.Libyaml is a lower
level, streaming API which is essentially a raw exposure of the underlying
libyaml C library. Data.Yaml uses the aeson Value data type and
ToJSON/FromJSON type classes for higher level serialization. For many
cases, this approach works well, though there are problems:
* There are problems with roundtripping, since YAML allows for ambiguity
about the data type of values. For example, in the yaml snippet `foo:
1234`, is 1234 intended to be numeric or a string? Either is valid.
* YAML is intended to be human-readable output. But Data.Yaml provides no
control over the encoded representation, e.g. should we use single or
double quotes for a string (or no quotes at all), or the order of values in
For other examples, just look at the issue tracker for yaml.
I don't want to drop the current aeson-based functionality, since I think
it's still valid and useful in many cases. But I do think it's worthwhile
to add in an alternative API which handles YAML-specific constructs better.
My idea is:
* Create a new Data.Yaml.Aeson module, and have it mirror Data.Yaml.
* Deprecate Data.Yaml.
* Create a new Data.Yaml.? module to contain this YAML-specific API.
I'm asking for feedback on that last point. I have some basic ideas on what
such an API would look like, but given that there are many people using
YAML in ways different than how I'm using it, I don't think an API designed
entirely by me will suit all use cases.
I've opened up a new issue to track this work. If you're interested in
participating in this design, please contact me. I'm happy to have the
discussion on this mailing list, but if (as I suspect) there are just a
handful of people who are interested in pushing this forward, it likely
makes sense to take the discussion offlist.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe