[Haskell-cafe] Standard package file format

Joachim Durchholz jo at durchholz.org
Mon Sep 19 07:21:50 UTC 2016


Am 19.09.2016 um 02:12 schrieb Richard A. O'Keefe:
>
>
> On 16/09/16 6:37 PM, Tobias Dammers wrote:
>> Another factor in favor of YAML is that it is a superset of JSON,
>
> Here is a simple string in JSON:
>
> "Where's the Golden Fleece?"
>
> Here is the same string in YAML:
>
> --- Where's the Golden Fleece?
> ...
>
> Superset?

Yes. The original string is also valid in YAML if used in the position 
where JSON allows a string.

> If you mean that any data value that can be represented in JSON
> can be represented (differently!) in YAML, fine, but that's not
> the same thing.

Sure, but any valid JSON is also valid YAML.
Modulo some exotic exceptions for valid-but-useless and 
valid-but-probably-not-what-the-sender-intended JSON.

> Familiarity with JSON semantics and syntax did not help me AT ALL
> when faced with YAML.

Sure, YAML is a massive superset.
The advantage is more in interoperability - you can hook a YAML parser 
to JSON-outputting processes and expect that it will "just work", so you 
don't have to worry about syntax, so you don't need separate frontends 
for YAML and JSON for your webservice.

> Am I seriously recommending RDF (or possibly OWL-DL) as a good
> way to describe packages?  I am certainly serious that it should
> be CONSIDERED.

+1

> (1) JSON, XML, TOML, and YAML are all about serialising *data values*.
>     That's all they do.  Anything beyond that is up to you.
>     RDF and OWL are all about describing *relationships* between
>     *resources*.  It's worth considering carefully what you want to
>     say in a package file format.  If you want to describe
>     *relationships*, then something that deals with data values may
>     not be the right *kind* of "language".
>
>     Simply jarring people loose from the idea that a "single possibly
>     structured data value" language is the ONLY kind of language is
>     of value in itself.

It does have its advantages.
That's why everybody is using XML these days, after all. Even though XML 
does have some pretty horrible properties (too much noise being the most 
prominent).

> (2) JSON, XML, TOML, and YAML are all about serialising *data values*.
>     *Single* possibly structured data values.
>     That's all they do.  There is no sense in which there is any
>     standard way to *combine* data in these forms.

Yes, that's supposed to live at the semantic level, i.e. in the types.
For JSON and TOML that's a serious restriction.
In XML and YAML, you can keep type information (better standardization 
for that in YAML than in XML), so you can stick user-defined semantics 
into the serialization format if you want to.

I.e. you can achieve RDF in XML or YAML by writing types that handle 
combinability or anything else that you want, these things aren't tied 
into the language.

It is still possible that RDF is more convenient :-)


More information about the Haskell-Cafe mailing list