* Fix `yaml-to-dhall` support for empty objects
`yaml-to-dhall` was decoding an empty object into:
```dhall
[] : { mapKey : Text, mapValue : Text }
```
... instead of:
```dhall
[] : List { mapKey : Text, mapValue : Text }
```
... which this change fixes
* Add missing test files
* Hopefully fix test failure on Windows
I suspect that the test failure is due to the locale for the test suite
not being set to UTF8
* Handle empty alternatives when converting from JSON
Fixes https://github.com/dhall-lang/dhall-haskell/issues/1074
`dhall-to-{json,yaml}` treat empty alternatives as strings of the
same name, but `{json,yaml}-to-dhall` were missing the corresponding
logic to decode strings to empty alternatives, which this change
fixes.
This also ensures that the conversion logic contains no more
`undefined`s, by making the union conversion branch total.
* Clarify successful cases for union handling
Co-Authored-By: Simon Jakobi <simon.jakobi@gmail.com>
* Add missing trailing newline
... as caught by @sjakobi
* Fix `dhall-json`'s support for preserving alternative names
... as caught by @sjakobi in the course of #1077
The code has to be updated to reflect the new normal forms for
union literals
* Add tests
... as suggested by @sjakobi
Allow to generare quoted scalars if needed via providing a custom encode
options to Data.Yaml.encodeWith. So far two corner cases from yaml
itself (an empty scalar, and special strings) are omitted in the
implementation.
The motivation for this change is:
* To catch build failures in downstream packages whenever we make a breaking
change to the `dhall` API
* To reduce the amount of work I need in order to cut a release for all of
these packages
* To better share Nix/CI-related logic between the projects
Note that I have not yet migrated `dhall-nix` in. I'm waiting for
https://github.com/dhall-lang/dhall-nix/issues/17 to be fixed since
`dhall-nix` is incompatible with later versions of `megaparsec` due to
`hnix`.