[Haskell-cafe] Standard package file format

Richard A. O'Keefe ok at cs.otago.ac.nz
Sun Sep 18 23:22:03 UTC 2016

YAML and TOML are not, strictly speaking, package file formats.
They are *meta-formats*.
There is, by design, nothing about them that ties them in any
way to any kind of package system.
That means that other, even more popular, meta-formats
should be considered.
In particular, while XML and JSON are not by any means
*wonderful*, they are far better known than TOML or even YAML.

On 16/09/16 6:20 PM, Harendra Kumar wrote:
> From a developer's perspective, the major benefit of a standard and
> widely adopted format and is that people can utilize their knowledge
> acquired from elsewhere, they do not have to go through and learn
> differently looking and incomplete documentation of different tools. The
> benefit of a common config specification is that developers can choose
> tools freely without worrying about learning the same concepts presented
> in different ways.

If we are talking about *meta-formats*, this is only half
true.  No amount of knowledge about YAML per se will tell
you how to use YAML to describe Haskell packages.  Nor will
it let you choose tools freely if what you want is tools
that understand your *package file format* specifically.
(For example, editors that can drop in handy templates,
or validate a description.)

> * YAML (http://yaml.org/spec/1.2/spec.html) is standard and popular. A
> significant chunk of developer community is already familiar with it. It
> is being used by stack and by hpack as an alternative to cabal format.
> The complaint against it is that the specification/implementation is
> overly complex.

It's not clear what "standard" means in this context.
yaml.org *calls* it "standard", but as the joke puts it,
"CALLING a tail a leg doesn't MAKE it a leg."
XML is a standard: it's managed by a well-known body.
JSON is both an ECMA standard and an Internet RFC.

There are other complaints:
  - that there is no *other* reason for most Haskell programmers
    to be aware of YAML,
  - that stack and hpack do not use "YAML" but an underspecified
    subset of YAML, and that
  - that due to YAML's complexity different implementations tend to
    implement different subsets, meaning less interoperability than
    you'd expect,
  - that the Ruby documentation for its YAML module
    says "Do not use YAML to load untrusted data.  Doing so is
    unsafe and could allow malicious input to execute arbitrary
    code inside your application."  I must admit I'm surprised.
  - ...

Could I respectfully suggest that the first step in a project
like this is to describe the *semantics* of your package management
information in a language-neutral way?  I know a great language for
describing abstract data types and giving them semantics.  It's
named for some logician, I think his surname was Curry.  (:-)

Seriously, there seems to be an endemic problem with programmers
racing to syntax without thinking over-much about semantics.  It
happened with XML.  It happened again with RDF.  Eventually the
semantics gets patched up, after pointless pain and suffering.

Having nutted out exactly what the issues are with the semantics,
then you can experiment with syntax.

More information about the Haskell-Cafe mailing list