Growing Haskell Platform

Roman Cheplyaka roma at ro-che.info
Fri Dec 7 09:54:42 CET 2012


* Michael Snoyman <michael at snoyman.com> [2012-12-07 09:52:07+0200]
> Let me bring up one other package: yaml (written by me). I think it's a
> pretty good fit for the standard YAML packaging library, since it simply
> reuses the existing infrastructure from the aeson package (i.e. the ToJSON
> and FromJSON typeclasses, and the Value datatype). But I'm actually a bit
> concerned about proposing it, based on some history.

When I was looking at existing YAML libraries, I rejected yours when I
saw JSON types. (I did see the "do not let that confuse you, it's
intentional" warning, and no, it didn't help.)

Besides giving the feeling that the API is a hack, this will inevitably
confuse readers of my code who are not familiar with the library and,
just based on the names, will assume that the code is working with JSON,
not YAML.

IIUC, "all of the existing tools for JSON processing" are mainly just
existing FromJSON instances. I am not sure how common this situation is,
but for that you could define a newtype whose FromYAML instance would
internally use the FromJSON instance of the underlying type.

Or perhaps the JSON-agnostic subset of aeson could be extracted into a
separate library, which both aeson and yaml would depend on.

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.

Roman



More information about the Libraries mailing list