Commit Graph

909 Commits

Author SHA1 Message Date
PanAeon
e6be5c050e
LSP. Fix import errors location. Minor clean-up. Add tests for backend/diagnostics. (#868) 2019-03-26 13:20:25 +00:00
Gabriel Gonzalez
4c9dc60b20
Fix dhall decode bug (#859)
... as caught by @singpolyma

`Dhall.Binary.unApply` was failing to uncurry functions due to the presence of
`Note` constructors.  This caused `dhall encode` to produce different
results from `dhall hash` since the latter was normalizing the expression
(and therefore removing `Note` constructors) whereas the former was not.
2019-03-24 13:18:21 -07:00
Gabriel Gonzalez
c900081a34
Remove deprecated Path constructor (#858)
The `Path` constructor was deprecated a long time ago, so it's pretty
safe to remove now
2019-03-24 12:21:08 -07:00
Gabriel Gonzalez
ff3dc7f9e7
Add --help information for --annotate flag (#856) 2019-03-24 11:42:27 -07:00
Gabriel Gonzalez
c3ba33a80a
Add unit tests (#854)
... as standardized in https://github.com/dhall-lang/dhall-lang/pull/416
2019-03-24 11:01:43 -07:00
Gabriel Gonzalez
dce46fc6c8
Add --alpha flag to α-normalize output (#855)
Fixes https://github.com/dhall-lang/dhall-haskell/issues/853

... as suggested by @singpolyma
2019-03-16 11:20:19 -07:00
Justin Le
35513e715a Fix for UnionType (#857)
Fix the type equality check by using judgmental equality
2019-03-16 10:12:55 -07:00
Gabriel Gonzalez
d8f2787745
Link to Discourse site from dhall-lang.org (#852) 2019-03-14 08:48:23 -07:00
Gabriel Gonzalez
bffe2ed2a1
Remove support for URL fragments (#851)
... as standardized in https://github.com/dhall-lang/dhall-lang/pull/406
2019-03-14 07:23:23 -07:00
Gabriel Gonzalez
4b7bdd458c
Add CORS support (#846)
... as standardized in https://github.com/dhall-lang/dhall-lang/pull/411
2019-03-12 18:36:38 -07:00
Gabriel Gonzalez
b31ec4db5c
Narrow the imports used by the test suite (#850)
As standardized in https://github.com/dhall-lang/dhall-lang/pull/420
2019-03-11 20:47:09 -07:00
Gabriel Gonzalez
f703d271b6
Add Nix support for dhall-lsp-server project (#849) 2019-03-10 09:43:44 -07:00
PanAeon
21f9e951cc
[LSP] add basic formatting (#844) 2019-03-08 14:24:54 +00:00
Gabriel Gonzalez
1e3c2a1c84
Be more strict when decoding variables named "_" (#847)
... as standardized in https://github.com/dhall-lang/dhall-lang/pull/407
2019-03-07 22:09:41 -08:00
Gabriel Gonzalez
2efed4b4a5
Expand the set of valid quoted labels (#840)
... as standardized in https://github.com/dhall-lang/dhall-lang/pull/408
2019-03-07 21:42:57 -08:00
Gabriel Gonzalez
33c695fd55
Fix versions of dhall-bash/dhall-text (#845)
I forgot to bump these versions when cutting the latest release
2019-03-07 21:12:03 -08:00
Gabriel Gonzalez
e92a749904
Change language around security guarantee (#841)
Related to https://github.com/dhall-lang/dhall-lang/issues/333

This softens the language to point out that we can't guarantee
that we are secure against malicious expression but we do aim to be
and we don't settle for less.
2019-03-07 20:43:37 -08:00
PanAeon
f2f4fc2979 Add dhall-lsp-server (#843) 2019-03-06 21:41:38 -08:00
Gabriel Gonzalez
e392657540
Version 1.20.1 → 1.21.0 (#839) 2019-03-06 20:49:41 -08:00
Gabriel Gonzalez
f6d6ccd0c5
Add new --omitEmpty option (#842)
... as proposed in https://github.com/dhall-lang/dhall-kubernetes/issues/46#issuecomment-468530601

`--omitEmpty` is the same as `--omitNull` except it also omits fields that
are empty records.  To be precise, it omits fields whose transitive fields
are all `null` (and an empty record is a special case of a record whose
transitive fields are all `null` since it is vacuously true when there are
no fields).

This allows Dhall configurations that target YAML to avoid having to nest
sub-records inside of an `Optional` value.  Omitting unnecessary `Optional`
layers reduces the number of default values that the configuration format
needs to thread around.
2019-03-06 14:52:40 -08:00
Gabriel Gonzalez
aa359813c4
Install mostly static executables on OS X when using Nix (#830)
These aren't fully static executables (they still have some
`/nix/store` references), but they at least compile Haskell dependencies
statically.  That means that they can be `nix-env --install`ed side-by-side
with other Haskell executables, which would otherwise conflict with an
error like this one:

```
error: packages '/nix/store/hrxnlwlsiw5jjjkq5v6ihcwb0shx4fga-dhall-1.20.1/lib/li
nks/libHSbasement-0.0.8-8QjArDsw3GWCcbHE5iqtz3-ghc8.4.3.dylib' and '/nix/store/d
2y5373anwf1q3h86ar3lljk11k1lq0h-dhall-json-1.2.6/lib/links/libHSbasement-0.0.8-8
QjArDsw3GWCcbHE5iqtz3-ghc8.4.3.dylib' have the same priority 5; use 'nix-env --s
et-flag priority NUMBER INSTALLED_PKGNAME' to change the priority of one of the
conflicting packages (0 being the highest priority)
```
2019-03-04 19:43:31 -08:00
Gabriel Gonzalez
05d9405d29
Simplify import resolution logic (#833)
... as standardized in https://github.com/dhall-lang/dhall-lang/pull/391

This also updates the `loadWith` judgment to more closely match the variable
names used in the standard
2019-03-04 19:11:25 -08:00
Fabrizio Ferrai
b7af16a869 Use binary encoding in parser tests (#836) 2019-03-03 15:28:55 -08:00
Fabrizio Ferrai
74e8003905
Sort record and union fields when CBOR-encoding (#835)
Also sort fields in the `Arbitrary` instance for `Dhall.Map` in serialization tests
2019-03-04 00:08:43 +02:00
Basile Henry
13a1158538 Fix REPL autocomplete (#837)
This commit fixes an issue that made the last branch of the completer
unreachable.

The second to last branch was always `True`:

```
> split (== '.') "anything"
["anything"]
```

Signed-off-by: Basile Henry <bjm.henry@gmail.com>
2019-03-02 14:54:18 -08:00
Gabriel Gonzalez
36f0e55a5f
Remove the constructors keyword (#829)
... as standardized in https://github.com/dhall-lang/dhall-lang/pull/385
2019-02-27 21:44:36 -08:00
Gabriel Gonzalez
375688c97c
Small improvements to dhall format (#831)
Fixes #832 832

This includes two changes:

* Fix a missing newline at the end of `dhall format` output when not using
  the `--inplace` option

* Better align ASCII output
2019-02-27 11:32:48 -08:00
Gabriel Gonzalez
744a90c547
Add :set/:unset commands to dhall repl (#828)
Fixes https://github.com/dhall-lang/dhall-haskell/issues/823

These allow one to enable or disable command-line options

Currently these only support `--explain`
2019-02-25 08:51:02 -08:00
Gabriel Gonzalez
45a6ceedaa
Explain how to use cache.dhall-lang.org (#827)
Related to #783
2019-02-24 12:43:43 -08:00
Fabrizio Ferrai
8527a651d7 CBOR-encode only some special values as half-floats (#822)
Co-Authored-By: f-f <fabrizio.ferrai@gmail.com>
2019-02-23 11:21:28 -08:00
Gabriel Gonzalez
7604a5870e
Mention submodule in instructions (#820)
This prevents build failures when running tests for the `dhall` package
2019-02-23 10:53:38 -08:00
Javier Neira
d714754e14 Show some details in InvalidType error output (#824) 2019-02-23 09:49:14 -08:00
Gabriel Gonzalez
5b0686b01c
Fix relative precedence of != and == (#825)
Fixes https://github.com/dhall-lang/dhall-lang/issues/373

The standard specifies that `!=` should have higher precedence than `==`,
which this change fixes.
2019-02-23 08:56:16 -08:00
Ollie Charles
abddcd6678 Correct Dhall installation one-liner in README (#826)
The README missed the call to `curl -L`.
2019-02-23 08:31:43 -08:00
Gabriel Gonzalez
8663bfe296
Add linux-dhall* jobs to Hydra (#821)
Fixes https://github.com/dhall-lang/dhall-haskell/issues/783

These can be used to conveniently install Dhall using `nix-env` on Linux systems
2019-02-22 07:32:59 -08:00
Javier Neira
e8d4b78a3f Build dhall-json with lts-6 in appveyor (#818) 2019-02-15 15:09:35 -08:00
Gabriel Gonzalez
e3dde9dfa7
Implement Text/show (#811)
... as standardized in https://github.com/dhall-lang/dhall-lang/pull/365
2019-02-12 18:42:48 -08:00
Ollie Charles
7349eb08c3 Remove explicit recursion from Dhall lint in favour of micropasses (#817) 2019-02-12 17:18:23 -08:00
Gabriel Gonzalez
a3495fbe15
Add a standard-compatibility table (#816)
... as suggested by @jneira here:

https://github.com/dhall-lang/dhall-haskell/issues/791#issuecomment-457105469
2019-02-12 10:05:49 -08:00
Gabriel Gonzalez
112efa7df7
Fix import source locations (#815)
.. as caught by @Profpatsch in:

https://github.com/dhall-lang/dhall-haskell/pull/812#issuecomment-462134701

Before this change the location was always being reported as `(stdin):1:1`
because the `SourcedException` kept getting modified with a broader
source location in the `Note` branch of `loadWith`.

This was originally done so that alternative imports would show the entire
source span, but it mistakenly just kept bubbling up regardless of whether or
not there were alternative imports.

Instead, this includes an approximate source span for alternative imports.
The source span bounds are correct but the contents just show which imports
were alternated, even if they might have been buried in a larger expression.

For example, if the original expression had been:

```haskell
Some ./x ? None ./y
```

... then the source span for the error message would display just:

```haskell
./x ? ./y
```

... which is probably as good as it will get for now.
2019-02-12 09:04:32 -08:00
Gabriel Gonzalez
68c5278559
Support GHC 7.10.3 for all Dhall packages (#814)
This also updates the declared set of GHC versions tested with in the
`.cabal` files
2019-02-11 22:45:34 -08:00
Basile Henry
d20b1ca60d Save and load REPL context via :save and :load commands (#807)
The format for the save file is a plain Dhall file containing REPL commands.
This will hopefully mean that the save file can be edited manually if need be
without too much effort.

Signed-off-by: Basile Henry <bjm.henry@gmail.com>
2019-02-11 22:24:29 -08:00
Gabriel Gonzalez
98497e44ec
Add source position information for missing imports (#812)
Related to #561

This adds source position information to missing imports

Before:

```
$ dhall <<< './foo'

↳ ./foo

Error: Missing file …/foo
```

After:

```
$ dhall <<< './foo'

↳ ./foo

Error: Missing file …/foo

(stdin):1:1
```
2019-02-08 07:32:00 -08:00
Gabriel Gonzalez
2cdaf91636
Add --check flag to dhall format (#810)
Fixes #809

This allows the user to check if the input is formatted instead of formatting
the input
2019-02-06 18:19:25 -08:00
Gabriel Gonzalez
2f26dac1ff
Add support for Unicode path components (#800)
... as standardized in https://github.com/dhall-lang/dhall-lang/pull/353
2019-02-04 19:14:07 -08:00
Gabriel Gonzalez
04ec45803d
Remove version tag from encoded expressions (#805)
* Remove version tag from encoded expressions

... as standardized in https://github.com/dhall-lang/dhall-lang/pull/362

This includes backwards compatibility for older encoded expressions
2019-02-03 21:17:41 -08:00
Gabriel Gonzalez
15d0b8d063
Change dhall freeze to only freeze Remote imports (#808)
The motivation behind this change is so that users can freeze remote imports
(like the Prelude) but ignore local imports so that subsequent runs of the
interpreter reflect changes to local files and environment variables.

The reasoning behind this is that there are two primary benefits of integrity
checks:

* Improved security
* Caching

... and one downside which is that updates to those imports are not pulled in
until the integrity check is updated or removed.

However, environment variables and local file paths do not benefit from
improved security or caching, so there is only a downside to freezing them.

Specifically:

* Environment variables and local file paths are both cheap to resolve

  ... so they don't really benefit from caching.

  To be precise, they *could* benefit from caching if the cache expression is
  cheaper to parse and normalize compared to the original file.  For those
  cases there is still an `--all` flag to freeze all imports.

* Environment variables and local file paths are trusted

  For example, when a user runs the `dhall` executable they are implicitly
  trusting their filesystem which provides that executable.  Similarly, when
  they run `dhall` without an absolute path they are implicitly trusting that
  their `PATH` environment variable has not been compromised to point to a
  malicious executable.

  Up until now, Dhall's threat model has always been that local imports are
  trusted but remote imports are not, so this is consistent with that threat
  model.

... so as far as environment variables and local files are concerned there are
only downsides to freezing them and no up-side.  This is why this change
no longer freezes them.

This also renames `hashImport` to `freezeImport` for more terminology
consistency.
2019-02-01 07:46:03 -08:00
Ville Tirronen
b2514ff8bf Add --immediate-dependencies flag to resolve mode (#803)
This is useful for integrating dhall to build systems where dhall
expressions (e.g. of type `Text`) are build products.

This also renames the `--list` flag to `--transitive-dependencies`
2019-01-31 15:24:17 -08:00
Gabriel Gonzalez
1a94f5558e
Fix parser for natural-raw (#804)
Fixes https://github.com/dhall-lang/dhall-lang/issues/357

This uses `Text.Megaparsec.Char.Lexer.decimal` which matches the Dhall
grammar.  The previous `decimal` parser was also accepting non-standard
hex and octal literals.
2019-01-31 13:05:19 -08:00
Basile Henry
29375ad462 Add :hash command to the repl (#806)
Signed-off-by: Basile Henry <bjm.henry@gmail.com>
2019-01-31 12:12:05 -08:00