dhall-lang / dhall-haskell

Maintainable configuration files
https://dhall-lang.org/
BSD 3-Clause "New" or "Revised" License
908 stars 211 forks source link

Is there a specification for dhall-to-{json,yaml} and {json,yaml}-to-dhall? #2594

Open winitzki opened 3 weeks ago

winitzki commented 3 weeks ago

As part of my study of programming language theory, I have recently implemented a Dhall interpreter in Scala, which was a great experience because the Dhall language is so well documented and there is a standard test suite. My project is here https://github.com/winitzki/scall

Now I would like to be able to implement also the converters from Dhall to json/yaml and back. Where do I begin? Is there some specification or documentation about how Dhall expressions are converted to json/yaml and back? Is there a standard test suite that exercises all options?

Gabriella439 commented 3 weeks ago

The conversion between JSON and YAML is not part of the Dhall standard. In fact, the standard doesn't actually specify anything about how Dhall expressions are converted to any file format, with one caveat: the standard does provide utilities in the Prelude specifically designed for use with some of the (non-standard) Dhall conversion utilities (e.g. dhall-to-json).

All of the logic for the Dhall conversions to and from JSON and YAML resides in the dhall-haskell repository, specifically in the dhall-json and dhall-yaml subprojects. Those subprojects also have test suites although they're nowhere near as comprehensive as the standard test suite.