Open samuela opened 2 years ago
(Side note: why are yaml related tools included in dhall-json
?)
The yaml-to-dhall
executable is now provided by a separate dhall-yaml
package.
You can find some explanation of this here: https://github.com/dhall-lang/dhall-haskell/tree/master/dhall-yaml#introduction
… but I'll also expand upon that in more detail.
The organization behind the two packages is an artifact of the Haskell ecosystem's YAML support. There are two Haskell packages that support YAML:
yaml
package is a wrapper around the C libyaml
library with a BSD 3-clause licenseHsYAML
package is a more recent pure Haskell implementation of YAML support, but with a GPLv3 licenseOriginally, all of the tools (dhall-to-{json,yaml}
and {yaml,json}-to-dhall
) were provided by the dhall-json
package back when there was only the yaml
package. The main reason for bundling both JSON and YAML tools within the same package is because Haskell's aeson
package (which provided JSON support) and Haskell's yaml
package (which provided YAML support) shared the same underlying representation, so when we implemented JSON support we got YAML support essentially for free.
However, there were a few downsides of using the yaml
package:
It depended on a C library
… so it was incompatible with non-native backends such as GHCJS
It reused the Value
type from the aeson
package
In some ways this was a feature (again, JSON support meant YAML support for free), but in other ways this was a downside, because the Value
type from the aeson
package does not correctly model some YAML features
So we decided to split out a separate dhall-yaml
package which would depend on the newer HsYAML
package, that way the dhall-json
package could keep its BSD 3-clause license.
However, the next question was how to avoid name conflicts between the dhall-to-yaml
and yaml-to-dhall
executables provided by the dhall-json
and dhall-yaml
packages.
For dhall-to-yaml
, we decided to name the one from the dhall-yaml
package dhall-to-yaml-ng
to avoid the conflict
For yaml-to-dhall
, we decided to move it entirely from the dhall-json
package to the dhall-yaml
package because correctly handling YAML eventually required some functionality that was only available from the HsYAML
package.
There was a related discussion about that which you can find here:
Thank you for such a detailed explanation @Gabriel439! I'll try moving forward with the dhall-yaml
package.
Oops, I closed too soon! I'm not able to find the dhall-yaml
package:
❯ nix-shell -p dhall-yaml
error: undefined variable 'dhall-yaml' at (string):1:94
(use '--show-trace' to show detailed location information)
I'm finding this to be the case even as recent as commit 5efc8ca954272c4376ac929f4c5ffefcc20551d5.
Try haskellPackages.dhall-yaml
What's happening here is that some Haskell packages provide top-level attributes where pkgs.${foo} = pkgs.haskell.lib.justStaticExecutables pkgs.haskellPackages.${foo}
. For example, that's the case for dhall-json
, but nobody has wrapped dhall-yaml
in a similar way, yet
Describe the bug
Dhall claims to include an executable
yaml-to-dhall
(source). I'm able to finddhall-to-yaml
, but notyaml-to-dhall
:Steps To Reproduce
Illustrated above.
Expected behavior
A clear and concise description of what you expected to happen.
Screenshots
n/a
Additional context
n/a
Notify maintainers
@Gabriel439 (I had a hard time tracking down how dhall/dhall-json are packaged, and was not able to find a
meta.maintainers
, but this is my best guess 🤷)Metadata