Full coverage of all Expr constructors is now checked by the
type-checker. This revealed that that the IntegerToDouble, TextShow,
Some and None constructors were missing.
Also:
* Increase frequency for Lam, Pi and App
* Fix a few inconsistencies in normalization
* Remove some dead code in D.T.QuickCheck
Closes#1256.
* Change `dhall type` to resolve imports
Fixes https://github.com/dhall-lang/dhall-haskell/issues/1277
The original motivation was that `dhall type` would represent a
type-inference-only phase. However, in practice that wasn't very useful
so `dhall type` now performs import resolution followed by type inference.
* Fix loading relative to root directory
... as caught by @sjakobi
Co-Authored-By: Simon Jakobi <simon.jakobi@gmail.com>
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
* Small fixes to `dhall diff`
Related to https://github.com/dhall-lang/dhall-haskell/issues/1255
* Simplify function type diffs by omitting the bound variable name when possible
* Non-zero exit code when `dhall diff` is non-empty
Note that this is a breaking change to the `Dhall.Diff` API by changing the
exposed utilities to all expose the more general `Diff` type instead of a
`Doc`. This means that we also no longer need separate exports for
`diff` and `diffExpression`.
* Fix build failure for tests
* Fix golden test result
* Rename `diffExpression` to `diff`
... as suggested by @sjakobi
* Add test coverage for diffing function types
* Fix `Inject` instance for lists
Fixes#1254
This also adds tests for conversions back and forth between Dhall and
Haskell values
* Add `Inject` instances for `Scientific` and `String`
... so that we don't need to comment them out!
* Use `tasty-expected-failure`
... to exercise tests that we currently skip
Fixes https://github.com/dhall-lang/dhall-haskell/issues/1245
* Fix bounds syntax for `tasty-expected-failure`
... as caught by @sjakobi
Co-Authored-By: Simon Jakobi <simon.jakobi@gmail.com>
* Fix GHC 8.6 build failure
`tasty-expected-failure` needs to be bumped to include revision 1, which
supports GHC 8.6
* Fix build failure for older `tasty-hunit` versions
`tasty-hunit-0.9.2` and older have the wrong type for `assertFailure`
* Fix `stack` build for LTS 6
... and sort the list of `extra-deps`
This is essentially the exact same problem and fix as #1213
Normally I would add a test, except that our test suite for diffs doesn't
yet support escape codes. However, the basic problem was the following
output:
```
$ dhall diff '"1"' '"2"'
- "…"
+ "…"
```
... which now displays (with color highlighting) this output:
```
$ dhall diff '"1"' '"2"'
"12" -- Imagine that the 1 is red and the 2 is green
```
* Improve HTTP errors
Fixes https://github.com/dhall-lang/dhall-haskell/issues/1251
This improves HTTP error messages by:
* Expanding the set of recognized status codes
* Adding up to 7 lines of the response body
For example:
```
Error: Remote file missing
URL:
↳ https://httpbin.org/statu
Message:
1│ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
2│ <title>404 Not Found</title>
3│ <h1>Not Found</h1>
4│ <p>The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again.</p>
```
* Always include HTTP status code in output
... as suggested by @sjakobi
* Use "not found" wording for 404 message
This is closer to the official wording for the error message
* Compress error message formatting
There's no need to put the URL and status code on separate lines since
they are compact
* [dhall format] Prefer unquoted URLs
This updates `dhall format` to prefer unquoted URLs.
I included the test cases described in #1109, but along the way I
discovered a standard bug so I have opened dhall-lang/dhall-lang#704 to
fix it. This change depends on that upstream fix.
Fixes#1109.
* pull in latest dhall-lang
* skip unimplemented tests
This entails a bunch of surgery to the package set used with LTS 6.
Because I was seeing errors, I disabled allow-newer and found this
consistent package set. I also needed a newer version of `tls`, which
entailed a bunch of bumps.
Previously, hovering over any part of a non-dependent function type like
`Bool -> Bool` would result in the type of the domain being displayed
(`Bool` in this example). The correct type is `Type`.
This bug resulted from the fact that we
expected all functions types to be syntactically of the form
`forall (b : Bool) -> Bool`, disregarding the simpler syntax for the
non-dependent function space (which desugars to
`forall (_ : Bool) -> Bool`).
* Remove superfluous language extensions
* Remove use of ScopedTypeVariables
In order to make the code more accessible it makes sense to refrain from
using ScopedTypeVariables, which we only used in two places.
* Remove use of LambdaCase extension
The new tests were introduced in dhall-lang/dhall-lang#698.
Also:
* Document shortcommings of Expr's Eq and Ord instances.
Haddock for GHC-7.10.3 can't handle haddocks on vanilla derived
instances, so we use StandaloneDeriving.
* Add explanation for skipped AssertNaN test
* Correctly handle dependent types in dhall-lsp-server
Removes the "fast path" when typechecking `let`s whose bound expression
has a small type. This optimisation is no longer legal in the presence
of dependent types (as introduced in #1164).
* Fix bad merge
* Remove redundant import
* 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
* Make equivalences of terms of different types fail during typechecking
This fixes the `EquivalenceNotSameType` test from
https://github.com/dhall-lang/dhall-lang/pull/698.
* s/assertion/equivalence
Previously the annotated type would have too many line-breaks, e.g. when
the result of annotating
let id = \(A : Type) -> \(a : A) -> a
was
let id : ∀ ( A
: Type
)
→ ∀ ( a
: A
)
→ A = \(A : Type) -> \(a : A) -> a
while it should be
let id : ∀(A : Type) → ∀(a : A) → A = \(A : Type) -> \(a : A) -> a
This restricts the clickable link part of an import to just the actual
link; previously we also underline hash and headers if those were
present.
Now:
./Bool/package.dhall sha256:7ee950e7c2142be5923f76d00263e536b71d96cb9c190d7743c1679501ddeb0a
~~~~~~~~~~~~~~~~~~~~
Previously:
./Bool/package.dhall sha256:7ee950e7c2142be5923f76d00263e536b71d96cb9c190d7743c1679501ddeb0a
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Try to cache the extra-deps from stack-lts-6.yaml
* Limit `stack bench` to the dhall package
For some reason `stack bench` triggers a rebuild of _all_ the local
packages, which we don't need.
Fixes https://github.com/dhall-lang/dhall-haskell/issues/1211
The original implementation of diffing two lists in #450 attempted to add a
special case in the logic for when the list had no common elements.
However, this led to a bug where the two lists would display different
if they were both empty.
lists would never render.
This change fixes that by removing the special case.
The new output for the linked example is:
```
Use "dhall --explain" for detailed errors
Error: Assertion failed
[ …
, - 1
, …
, + 55
]
16│ assert : fibs 10 ≡ [ 0, 1, 2, 3, 5, 8, 13, 21, 34, 55 ]
17│
(stdin):16:16
```
* Implement completion support
Completes the following:
- environment variables
- local imports
- identifiers in scope (as well as built-ins)
- record projections
- union constructors
* Add support for general dependent types
Removes the non-dependent let path. Needed since #1164 added support for
general dependent types.
* Remove unused import
* Use monad instance to cast between `Expr Src _`
As suggested by @Gabriel439: Use `typeOf (do _ <- expr; holeExpr)`
instead of `fmap undefined expr`. In the absence of `Embed` constructors
(in this case `Import`s) the two are equivalent.
* Simplify completeFromContext
Caught by @Gabriel439
* Remove debug code
* Add 1s timeout to listDirectory call
As pointed out by @Gabriel439, listDirectory can be a potentially
expensive operation. Adding a timeout should improve the user
experience.
* Fix unclean merge
* Clean up dhall-lsp-server.cabal
Removes unused dependencies.
* Upgrade to haskell-lsp-0.15.0.0
The stackage LTS version is still 0.8.2 so we need to add this as an
'extra-dep'.
* Display type information as plaintext rather than markdown
* Fix nix build
* Update nix haskell-lsp-types