Commit Graph

1354 Commits

Author SHA1 Message Date
Simon Jakobi
149e80346b
AppVeyor: Install stack without using Chocolatey (#1479)
Also don't build branches that have "appveyor" in their name.
That seemed just redundant to me.
2019-10-26 22:24:54 +02:00
Gabriel Gonzalez
90415e12d1 Update release script (#1477)
This is automating slightly more of the release process that I perform
2019-10-26 16:23:50 +00:00
Gabriel Gonzalez
d08ccfb384
Update website to use dhall-json for generating YAML (#1476)
Now that we depend on a pure Haskell implementation of YAML we can
use the `dhall-json` package for rendering YAML with GHCJS
2019-10-25 20:39:21 -07:00
Gabriel Gonzalez
8e7586b247
Fix dhall-to-yaml to quote special strings (#1474)
Fixes https://github.com/dhall-lang/dhall-haskell/issues/1472

This also refactors the code to a form that was easier for me to understand
2019-10-25 08:29:32 -07:00
Gabriel Gonzalez
90315e9eda Fix dhall freeze to always re-freeze an import (#1471)
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.
2019-10-24 15:19:09 +00:00
Simon Jakobi
8f2c28a5dc
Move normalization code from Dhall.Core to a new module Dhall.Normalize (#1452)
Also try to decouple a few modules from Dhall.Core.

Closes #1127.
2019-10-24 00:01:02 +02:00
Simon Jakobi
6c2db48d42 Fix operator precedence in the parser (#1466)
Previously some operator expressions were associated incorrectly, e.g.

* a || b + c  -> (a || b) + c
* a // b == c -> (a // b) == c

Fixes #1457.
2019-10-23 19:50:17 +00:00
Michael Gilliland
16e6a12c3d Resolve #1451: fix format --check given STDIN input. (#1462)
* 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.
2019-10-23 14:51:06 +00:00
Simon Jakobi
0f3a89eae6
Tweak the Header generator a bit (#1463)
* Reduce the discard rate by generating shorter Headers
   with more characters from the valid-ASCII range
* Shrink headers too
2019-10-23 05:06:24 +02:00
Basile Henry
3c99d5c988 Fix precedence of the import alt operator (#1460)
* Add test for format precedence #1455

* Fix precedence of the import alt operator
2019-10-23 01:19:50 +00:00
Simon Jakobi
62fd7a1b0d
Clarify the types involved in the formatting idempotence test (#1456)
Previously it wasn't obvious what the type parameters for the
'Expr' are.
2019-10-22 23:48:08 +02:00
Simon Jakobi
a3d9d2c9d2 Make the number of test cases for the idempotence test configurable on the CLI (#1453) 2019-10-22 20:38:55 +00:00
Basile Henry
69b228454e Test that dhall format is idempotent (#1427) 2019-10-22 19:45:08 +02:00
Sergei Dolgov
ad443cd685 Fix dhall-lsp-server to be "-Wall clean" (#1446) (#1449) 2019-10-21 12:54:00 +00:00
Philip Potter
1fed252488 fix index in MismatchedListElements (#1448)
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.
2019-10-20 22:34:00 +00:00
Gabriel Gonzalez
7b414d9846
Version 1.26.1 → 1.27.0 (#1428) 2019-10-20 07:00:43 -07:00
Gabriel Gonzalez
47383de623 Update Dhall.Tutorial module (#1439)
* 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>
2019-10-20 00:38:07 +00:00
Simon Jakobi
a944d12591 Add --file option for dhall hash (#1445)
To use the existing utilities in Dhall.Main more easily, I have moved
the implementation to Dhall.Main.
2019-10-19 22:38:44 +00:00
Simon Jakobi
bec6ce610f Move syntax things from Dhall.Core to a new module Dhall.Syntax (#1440)
This partially addresses #1127.
2019-10-19 20:13:22 +00:00
Steven Leiva
c284c19c11 Add --no-cache to dhall type. (#1441) 2019-10-19 13:47:27 +00:00
Simon Jakobi
301477de59 Rename Interpret to FromDhall, Inject to ToDhall (#1437)
* 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.
2019-10-19 03:24:49 +00:00
Steven Leiva
270adddf37 Add --no-cache flag to dhall resolve. (#1436) 2019-10-19 02:40:27 +00:00
Simon Jakobi
b75962a405 Use a more conventional spelling for "etags", mostly just use "tags" (#1432)
The previous "ETags" spelling was likely to cause confusion with HTTP ETags:
https://en.wikipedia.org/wiki/HTTP_ETag
2019-10-19 01:59:29 +00:00
Simon Jakobi
743d2ab5d6 dhall:tasty: s/skip/expectedFailures (#1438) 2019-10-18 23:22:44 +00:00
Steven Leiva
9d739b553a Do not warn about cache on --no-cache. (#1434) 2019-10-18 20:33:53 +00:00
48ca2d2424 Optionally pass Nixpkgs through entry functions (#1409)
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.
2019-10-17 19:06:21 -07:00
Gabriel Gonzalez
58fcc6fe90 Fix formatting in error message (#1429) 2019-10-17 08:51:56 +00:00
Gabriel Gonzalez
03ca91baca
Fix CI to properly reject incomplete haddocks (#1418)
My first attempt to do this in #1416 did not correctly reject incomplete
haddocks, which this change fixes
2019-10-16 19:49:44 -07:00
tenniscp25
a343b19a63 Marshalling HashMap (#1394) (#1426) 2019-10-16 15:53:33 +00:00
Simon Jakobi
40535f3f17
Format tests: Add newlines at the ends of the expected output files (#1424)
Fixes #1423.
2019-10-16 10:03:34 +02:00
Frederik Ramcke
3f6a5ad8df Restore idempotency when formatting comments (#1415)
* 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.
2019-10-15 15:01:10 +00:00
Patrick Mylund Nielsen
5087e4d22a
Bump aeson-yaml, and add YAML regression test for 'y' (#1420) 2019-10-15 09:18:21 -04:00
Jie
1cd856a449 [#1392] Injecting Data.Map (#1412)
* [#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>
2019-10-15 11:27:29 +00:00
Patrick Mylund Nielsen
c92c6bbc22
Eta: Remove YAML FFI code and disable dhall-nix build 2019-10-15 06:22:49 -04:00
Patrick Mylund Nielsen
96e694d7c6
'gpl' cabal flag to switch between HsYAML and aeson-yaml (#1417) 2019-10-15 03:12:12 -04:00
Gabriel Gonzalez
17fb0e3c46
100% haddock coverage (#1416)
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
2019-10-13 22:22:39 -07:00
Akshay Mankar
194654c10c Optionally allow missing lists in yaml/json-to-dhall (#1414)
[#1410]
2019-10-11 21:43:05 +00:00
Gabriel Gonzalez
4b8b8cd730
Add new record completion operator (#1375)
... as standardized in https://github.com/dhall-lang/dhall-lang/pull/767
2019-10-11 08:26:51 -07:00
Jie
34f706ed93 [#1395] Marshalling Set and HashSet (#1405)
* [#1395] Marshalling Set and HashSet

* Update dhall/src/Dhall.hs

Co-Authored-By: Simon Jakobi <simon.jakobi@gmail.com>

* Update dhall/src/Dhall.hs

Co-Authored-By: Simon Jakobi <simon.jakobi@gmail.com>

* Added distinctList

* setFromDistinctList updates

* Doctests abour ordering

* both set and hashset can ignore or fail with duplicates

* Comments on instances

* Moved length computation deeper

* Little wibble

Co-Authored-By: Simon Jakobi <simon.jakobi@gmail.com>
2019-10-10 16:31:44 +00:00
Dima
5b8ae442c8 Add tags subcommand (#1398)
Fixes #370.
2019-10-10 16:16:20 +02:00
Gabriel Gonzalez
a24ddfc3b9 Add support for leading separators (#1355)
* Add support for leading separators

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

Note that this does not yet change the formatter to use them

* Update `dhall-lang` submodule

* Fix `dhall.cabal` to mention new Prelude files

* Remove duplicate lines
2019-10-10 05:01:34 +00:00
Gabriel Gonzalez
9b9d1f54b1 Fix dhall-lsp-server to specify a UTF8 locale (#1369)
Related to https://github.com/dhall-lang/dhall-haskell/issues/1356#issuecomment-536840612
2019-10-10 04:19:42 +00:00
mujx
645b71d6b3 Functional tests setup for the LSP server (#1396)
* Functional tests setup for the LSP server

* Add nix derivation for lsp-test-0.6.1.0

* Register fixture files

* Enable functional tests on appveyor

* Attempt to fix Position errors

* Fix `dhall-lsp-server` to specify a UTF8 locale

Related to https://github.com/dhall-lang/dhall-haskell/issues/1356#issuecomment-536840612

* Specify utf8 encoding for tests

* Add test for hovering functionality

* Add glob to list fixture files

* Remove extra do
2019-10-10 02:27:15 +00:00
Michael Gilliland
1dba96c2c8 Resolves #1408: Add more detail in --explain when toMap has the w… (#1411)
* Resolves #1408: Add more detail in `--explain` when `toMap` has the wrong type.

Specifically, add common reason of using `{}` for record value.

For example,
``` shell
echo 'toMap {}' | ~/.local/bin/dhall
```

Outputs

> Error: ❰toMap❱ expects a record value
>
> Explanation: You can apply ❰toMap❱ to any homogenous record, like this:
>
>
>     ┌─────────────────────────────────────────────────────────────────────┐
>     │ let record = { one = 1, two = 2 }
> │
>     │ in  toMap record : List { mapKey : Text, mapValue : Natural}
> │
>     └─────────────────────────────────────────────────────────────────────┘
>
>
> ... but the argument to ❰toMap❱ must be a record and not some other
> type.
>
> Some common reasons why you might get this error:
>
> ● You accidentally provide an empty record type instead of an empty
> record when
>   using ❰toMap❱:
>
>
>     ┌──────────┐
>     │ toMap {} │
>     └──────────┘
>             ⇧
>             This should be ❰{=}❱ instead
>
> ────────────────────────────────────────────────────────────────────────────────
>
> 1│ toMap {}
>
> (stdin):1:1

* Add type annotation to `toMap` suggestion.
2019-10-09 23:54:42 +00:00
Jie
3e5cb34922 [#1381] Word* types to Natural, not Integer (#1387)
* #1381 Word* to Natural

* Added instance for Word

* Got rid of linting issues

* Added docsets

* Added comments

* Revert Crypto to master version

* Spread the doctests

* Improve Docstring
2019-10-07 17:54:42 +00:00
Andika Demas Riyandi
bf40ec52a1 add --output options to dhall (#1399) 2019-10-07 09:51:30 +00:00
Simon Jakobi
5e7794c652
Update dhall-lang submodule (#1403)
This includes some simplifications/optimizations for the `ToTerm DhallDouble` instance.

Most notably we let `cborg` take care of the correct encoding of NaNs:
See `Codec.CBOR.Write.doubleMP`:
  977c0c0820/cborg/src/Codec/CBOR/Write.hs (L571-L573)
2019-10-07 10:39:59 +02:00
Andika Demas Riyandi
9de7ac51a8 dhall: make lazyText use strictText (#1401) 2019-10-06 14:00:22 +00:00
Jie
cc3e50eaf1 [#1378] instance Interpret () (#1388)
* [#1378] instance Interpret ()

* Remove instance from tests
2019-10-06 03:46:25 +00:00
Curtis
c8ddedcc8c [#1389] Change Interpret [a] to use list (#1397) 2019-10-06 02:02:08 +00:00