* Attempt at fixing missing root certificate, #1491https://github.com/dhall-lang/dhall-haskell/issues/1491
* Remove extra comma in shared.nix
Co-Authored-By: Simon Jakobi <simon.jakobi@gmail.com>
* Update nix/shared.nix
Co-Authored-By: Gabriel Gonzalez <Gabriel439@gmail.com>
* Remove support for fusion
... as standardized in https://github.com/dhall-lang/dhall-lang/pull/792
* Update `dhall.cabal` to match the latest Prelude
* Update `dhall-lang`
... and blacklist tests we don't support yet
* Add missing files to `dhall.cabal`
... by not going through a `Term` intermediate
This gives a ~28% performance in decoding improvement, which means that
cache looks are not faster.
Here are the new decoding benchmarks before and after this change:
Before:
```
benchmarked Issue #108/Binary
time 266.5 μs (265.7 μs .. 267.4 μs)
1.000 R² (1.000 R² .. 1.000 R²)
mean 266.3 μs (265.6 μs .. 267.1 μs)
std dev 2.418 μs (1.891 μs .. 3.436 μs)
benchmarking Kubernetes/Binary ... took 36.94 s, total 56 iterations
benchmarked Kubernetes/Binary
time 641.3 ms (623.0 ms .. 655.4 ms)
0.999 R² (0.997 R² .. 1.000 R²)
mean 679.7 ms (665.5 ms .. 702.6 ms)
std dev 29.48 ms (14.15 ms .. 39.05 ms)
```
After:
```
benchmarked Issue #108/Binary
time 282.2 μs (279.6 μs .. 284.7 μs)
1.000 R² (0.999 R² .. 1.000 R²)
mean 281.9 μs (280.7 μs .. 287.7 μs)
std dev 7.089 μs (2.550 μs .. 15.44 μs)
variance introduced by outliers: 11% (moderately inflated)
benchmarking Kubernetes/Binary ... took 27.57 s, total 56 iterations
benchmarked Kubernetes/Binary
time 499.1 ms (488.1 ms .. 506.6 ms)
0.999 R² (0.998 R² .. 1.000 R²)
mean 498.9 ms (494.4 ms .. 503.9 ms)
std dev 8.539 ms (6.236 ms .. 12.56 ms)
```
There's a slight performance regression for the decoding microbenchmark, but
in practice my testing on real examples matches performance improvements seen
in the larger benchmark based on an example cache product from
`dhall-kubernetes`.
Note that is a breaking change because:
* There is no longer a `FromTerm` nor `ToTerm` class. Now we use the
`Serialise` class and `{encode,decode}Expression` now work on `ByteString`s
instead of `Term`s
* I further narrowed the types of several encoding/decoding utilites to expect a
`Void` for the first type parameter of `Expr`
* This is a regression with respect to stripping 55799 CBOR tags, mainly
because properly handling the tags at every possible point in the syntax tree
would considerably complicate the code
* dhall-lsp-server: Fix lower bound on dhall
… as reported in https://github.com/dhall-lang/dhall-haskell/issues/1494.
* Require base >= 4.11
Previously there were build failures with GHC-8.2 and 8.0 due to `(<>)` being out of scope.
* s/InputType/Encoder
* Rename input* functions on the ToDhall side to encode*
* Haddocks: Use "encoder" instead of "injector"
* s/Type/Decoder
* Haddocks: Stop using the word "parser" for Decoders
* Rename encode{Record,Union} to {record,union}Encoder
The motivation for this is so that `dhall` can be made much faster on very
large projects like `dhall-kubernetes-charts` where vast majority of the time
is spent rendering the very large `Context` when type-checking fails, delaying
the user from getting to the actual error message.
The `Context` also gets in the way of the user noticing the (far more useful)
type diff, but the performance cost is the primary motivation for this change.
If the user wants the context they can still use the `--explain` flag.
* Improve parsing error messages
The main changes are:
* Don't quote expected tokens in the error message (to avoid visual clutter)
* Consolidate expected tokens into simpler categories (e.g. "operator" or
"literal") instead of listing them all
For example, this would be an error message before this change:
```
$ dhall <<< '1 + [1'
dhall:
Error: Invalid input
(stdin):2:1:
|
2 | <empty line>
| ^
unexpected end of input
expecting "!=", "&&", "++", "->", "//", "//\\", "/\", "==", "===", "merge", "toMap", "||", "→", "∧", "≡", "⩓", "⫽", '#', '(', '*', '+', ',', '.', ':', '?', ']', built-in expression, double infinity, double literal, import, integer literal, label, list literal, natural literal, record type or literal, text literal, union type, or whitespace
```
... and this would be an error message after this change:
```
$ dhall <<< '1 + [1'
dhall:
Error: Invalid input
(stdin):1:4:
|
1 | 1 + [1
| ^^^^
unexpected " [1<newline>"
expecting (, import, keyword, label, or literal
```
* Fix test failures
* Fix warnings
Fixes https://github.com/dhall-lang/dhall-haskell/issues/1470
`dhall freeze` no longer attempts to use the cache to fetch an import since
the cache might not match the underlying import any longer. Instead,
`dhall freeze` now always attempts to fetch the underlying import to
compute the new hash.
* Resolve#1451: fix `format --check` given STDIN input.
I'm not really sure if this is the "best" approach so let me know if you
know a way to simplify this.
The issue was that `getExpressionAndHeader` was doing a second
`IO.getContents` (thus reading STDIN twice).
* Rename `Input` constructor.
If you run `dhall --explain` to explain a type error from a list with
mismatched elements, the index of the offending term was wrong. For a
minimal example, you can run:
dhall --explain <<<'[0, True]'
The problem is that `i` is an index into the tail of the list, not into
the whole list. The fix is just to add one to it to correct for the
missing head.
* Update `Dhall.Tutorial` module
This overhauls the `Dhall.Tutorial` module to reflect recent changes to
the language (and also to link to external documentation when possible).
* Fix doctests
* Rephrase import syntax caveat
... as suggested by @sjakobi
* Explain `<<<`
... as suggested by @sjakobi@
* Rephrase things
... as suggested by @sjakobi
* `s/The annotated/This/`
... as caught by @sjakobi
* Add commas to description of link to built-ins reference
... as caught by @sjakobi
Co-Authored-By: Simon Jakobi <simon.jakobi@gmail.com>
* Remove paragraph describing role of Prelude
* Update dhall/src/Dhall/Tutorial.hs
... as suggested by @sjakobi
Co-Authored-By: Simon Jakobi <simon.jakobi@gmail.com>
* Rename Interpret to FromDhall
The "Interpret" name remains in `InterpretOptions`, which are
actually used for marshalling in both directions.
* s/injectThenInterpretIsIdentity/embedThenExtractIsIdentity
* s/Inject/ToDhall
* s/shouldInjectInto*/shouldEmbedAs*
* Keep Interpret and Inject as constraint synonyms for compatibility
… as suggested by @Gabriel439.
The "builtins.fetchTarball" function is not available in some restricted
environments such as build jobs of the latest Hydra. Make it possible to
pass nixpkgs and nixpkgsStaticLinux when evaulating default.nix and
release.nix to avoid importing them internally. This does not change the
result of evaulation if no parameters are passed.
* Move prefix out of renderSrc
This reduces the complexity of renderSrc slightly without affecting
anything else much.
* Make formatting of comments idempotent
Fixes#1413. Previously the formatter would insert an additional line
break before some comments whilst preserving existing line breaks. In
order to restore idempotent behaviour, we need to strip a leading
newline character from the comment string in those cases, if present.
* Test idempotency when formatting comments
Test case taken from @AJChapman's bug report (#1413).
* Change argument order of renderSrc
Reads a bit more idiomatic, as suggested by @sjakobi.
* [#1392] Injecting Data.Map
* injecting via Generic
* Explicit instance
* Cleanup code
* Minor code cleanup
* Property testing for Inject/Interpret
* Refactor test
* Adding TypeApplications to .cabal
* No more TypeApplications
* Simplified tests using extract
* Added test for Text amnf fixed Natural import
* Update dhall/dhall.cabal
Co-Authored-By: Simon Jakobi <simon.jakobi@gmail.com>
* Update dhall/dhall.cabal
Co-Authored-By: Simon Jakobi <simon.jakobi@gmail.com>