Fixes#1559.
This requires aeson-yaml >= 1.0.5.0 since older versions
incorrectly encode empty objects.
The raised bound also fixes#1560. A regression test is included.
This raises the lower bound on prettyprinter to 1.5.1 since
`removeTrailingWhitespace` is buggy in earlier versions.
This jailbreaks hnix, which isn't compatible with prettyprinter-1.5.1 yet.
Fixes#183, #1400, #1525.
Co-authored-by: Gabriel Gonzalez <Gabriel439@gmail.com>
This causes text literals to be formatted as multi-line strings
whenever they contain at least one newline and at least one non-newline
character. "Spacers" like `"\n\n"` continue be formatted as single-line
strings. If the heuristic turns out to be too eager to choose a
multi-line layout, we can refine it later.
This partially addresses #1496.
Also
* update some variable names
* use 80-column "smart" layout consistently
This updates the `dhall` package to have 100% haddock coverage and
also updates CI to enforce this going forward.
This also includes a change to deprecate the `X` type synonym, which
I noticed along the way
* Add the `--preserveNull` flag and omit null fields by default on `dhall-to-yaml`
fixes#1354
* Restore the `--omitNull` flag and apply `--preserveNull` to `dhall-to-json`
* Adjust examples that return null fields
* Mention the default behaviour regarding nulls
* Null -> null
* Enable --pretty by default for dhall-to-json
* add Deprecation notice into dhall-to-json help
* update dhall-to-json output examples in src/Dhall/JSON.hs
Fixes a type mismatch error message which mentions JSON.
Fixes an "arithmetic overflow" exception which occurs when attempting to
parse a negative number as a `Natural`.
When enabled, we handle protected imports as if the semantic cache was
empty:
* Protected imports are resolved again, downloaded or read from
the filesystem as necessary.
* Protected imports are β-normalized, not αβ-normalized.
* Protected imports are checked against their SHA256 hashes,
failing to resolve if they don't match.
Context:
https://github.com/dhall-lang/dhall-haskell/pull/1275#issuecomment-528847192
Closes#1185.
This mostly reverts "Add support for multi-`let` (#675)" /
8a5bfaa3b9.
Also:
* Add fields for Src
This is useful for to make 'Note's less noisy during debugging:
first srcText expr
* 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
* Fix `--version` flag handling for `dhall-json` package
Fixes https://github.com/dhall-lang/dhall-haskell/issues/1198
This changes version to be a separate constructor for options parsing,
in order to make invalid states unrepresentable and to fix issues like
the above one.
* Undo `allowImports` changed
This was a change I forgot to stash while working on the fix for the
`--version` flag
* Fix missing `Paths_dhall_json` in `dhall-json.cabal`
This adds a new `--records-loose` flag and changes the default behavior
to `--records-strict`
The rationale for this change is so that this default behavior helps
more when users are still experimenting with the appropriate type to
use to decode a large and messy YAML file.
For example, suppose a user is trying to translate the following YAML
to Dhall:
```yaml
foo: 1
bar: true
```
... and they start with a empty Dhall type which they plan to fix in
response to error messages. They'd get a surprising success:
```bash
$ yaml-to-dhall '{}' < ./example.yaml
{=}
```
... because the old default behavior is to ignore extra fields in the
YAML. However, if we're strict by default then users don't have to
apply the `--records-strict` flag to get feedback on what they need
to change.
* Add `--file` option to `dhall-json` executables
Fixes https://github.com/dhall-lang/dhall-haskell/issues/1096
* s/JSON/expression/
... as caught by @sjakobi
Co-Authored-By: Simon Jakobi <simon.jakobi@gmail.com>
* s/expression/YAML expression/
... as caught by @sjakobi
Co-Authored-By: Simon Jakobi <simon.jakobi@gmail.com>
* Change the program descriptions for `{json,yaml}-to-dhall`
... as suggested by @sjakobi
* 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