Commit Graph

25 Commits

Author SHA1 Message Date
Simon Jakobi
7c91dd5f48 Fix Expr's Eq instance via a newtype wrapper for Doubles (#1347)
See the haddocks in Dhall.Core for details.

Fixes #1341.
2019-09-28 14:56:37 +00:00
Gabriel Gonzalez
93943a29c4 Format record fields more compactly if they fit on 1 line (#1314)
Fixes https://github.com/dhall-lang/dhall-haskell/issues/1313
2019-09-14 14:10:29 +00:00
Simon Jakobi
cb5ccab636 let-formatting: Insert hardline in front of the '=' instead of behind (#1302)
Fixes #1301.
2019-09-11 05:21:11 +00:00
Gabriel Gonzalez
96921f03ab
Fix dhall format to preserve let comments (#1273)
Related to https://github.com/dhall-lang/dhall-haskell/issues/145

Note that this also refactors `Let` to use `Binding` in order
to avoid having to duplicate `Src`-related fields in two
places.
2019-09-04 23:41:44 -05:00
Simon Jakobi
72fd2ac983
Treat multi-lets as syntactic sugar (#1242)
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
2019-08-31 18:31:24 +02:00
Gabriel Gonzalez
7f2f57f975
Add support for dependent types (#1164) 2019-08-03 21:38:01 -07:00
Ollie Charles
1b683295fc Implement Natural/subtract (#1133)
* Implement Natural/truncatedSubtract

* Restore commented out code

* Add pretty printing for Natural/truncatedSubtract

* Flip the order of the arguments

* truncatedSubtract -> subtract

* Whitespace

* Whitespace

* Whitespace

* Whitespace

* Remove a try

* Fix Core.hs

* Add a case in Arbitrary (Expr s a)

* Fix Dhall.JSON

* lift2 -> lift0

* Update Dhall.Diff

* Add extra reduction rules

* Fix

* Update Core.hs

* Update dhall-lang submodule

* Updated dhall-lang

* Try rolling back the dhall-lang revision

* Correct isNormalized

* Add more isNormalized rules

* Update dhall-nix
2019-08-02 00:12:43 +00:00
Simon Jakobi
beb1e7ba6f
Remove old union literal syntax (#1176)
…as standardized in https://github.com/dhall-lang/dhall-lang/pull/573.

Fixes #1175.
2019-07-31 04:44:36 +02:00
Ollie Charles
22d46103c1 Formatting: Indent applications (#1167)
Fixes #515
2019-07-29 18:24:20 +00:00
Simon Jakobi
0ee6ce6f6f Implement "Generalize empty list annotations" (#1112)
…as standardized in https://github.com/dhall-lang/dhall-lang/pull/630

Also:

* Update the dhall-lang submodule to the state of
  https://github.com/dhall-lang/dhall-lang/pull/654.

* Skip the nonCharacter test for now.

Fixes #414.
Fixes #770.
2019-07-20 18:05:23 +00:00
Mario
8aa2ac3ce9 Implementation of toMap (#1041)
... as standardized in https://github.com/dhall-lang/dhall-lang/pull/610
2019-07-15 08:28:29 -07:00
Gabriel Gonzalez
af0e77ce00
Consistently format multi-line strings (#1056)
Fixes #973

The formatter was behaving inconsistently for multi-line strings
depending on whether or not they were at the top level or nested as
a subexpression.  For example, the same multi-line string would be
rendered in multi-line form if it was at the top level and rendered
compactly if nested within another expression.

The root cause was that the pretty-printing logic was missing a top-level
`Pretty.group` call (which is the function responsible for enabling
compact representations if they fit), which this change fixes.
2019-07-02 13:54:54 -07:00
Gabriel Gonzalez
92bdd56a34
Switch Var to use an Int (#1044)
Related to: https://github.com/dhall-lang/dhall-haskell/issues/1039

We'll probably never see indices that exceed the space of an `Int` and
the interpreter would probably not be able to handle 9223372036854775807
nested binders anyway.
2019-07-01 17:24:13 -07:00
Gabriel Gonzalez
154d1c52cf
Remove support for old-style List-like Optional literals (#1002)
... as standardized in https://github.com/dhall-lang/dhall-lang/pull/572
2019-06-13 17:59:49 -07:00
Gabriel Gonzalez
3c08c627e8
Support projection by record type (#958)
... as standardized in https://github.com/dhall-lang/dhall-lang/pull/499
2019-05-27 20:54:42 -07:00
Gabriel Gonzalez
ba55d55307
Add support for fields named after built-ins (#875)
... as standardized in https://github.com/dhall-lang/dhall-lang/pull/437
2019-03-30 11:50:26 -07:00
Gabriel Gonzalez
a2ab6a59ec
Add support for empty alternatives (#863)
... as standardized in https://github.com/dhall-lang/dhall-lang/pull/438

This also adds `dhall-json` support for empty alternatives

In particular, this translates empty alternatives to strings encoding the alternative name

```haskell
-- ./example.dhall

let Role = < Wizard | Fighter | Rogue >

in  [ Role.Wizard, Role.Fighter ]
```

```
$ dhall-to-json <<< './example.dhall'
["Wizard","Fighter"]
```
2019-03-27 15:29:10 -07: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
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
David Virgilio
adf94a6503 Encode doubles as Double, do bounds checks, and add support for NaN and Infinity values (#667) 2018-11-20 15:07:08 -08:00
Gabriel Gonzalez
8a5bfaa3b9
Add support for multi-let (#675)
... as standardized in: https://github.com/dhall-lang/dhall-lang/pull/266

This also adds `dhall lint` support for consolidating nested `let` expressions
2018-11-13 08:01:59 -08:00
Gabriel Gonzalez
b3968f681a
Preserve Unicode characters (#679)
Fixes https://github.com/dhall-lang/dhall-lang/issues/267

According to the standard, Unicode characters up to `0x10FFFF` do not
require escaping.  See:

33cab24f8e/standard/dhall.abnf (L192)

... so we can preserve them when pretty-printing Dhall expressions.

Note that the current code still does not comply with the standard for Unicode
characters beyond `0x10FFFF`, but I'll defer fixing that to a subsequent
change.
2018-11-12 09:46:33 -08:00
Dan Burton
7aba79118c Use an Ordered Set for Project (#670) 2018-11-05 19:59:01 -08:00
Gabriel Gonzalez
aecfbc9acc
Migrate dhall-{bash,json,text} into this repository (#661)
The motivation for this change is:

* To catch build failures in downstream packages whenever we make a breaking
  change to the `dhall` API
* To reduce the amount of work I need in order to cut a release for all of
  these packages
* To better share Nix/CI-related logic between the projects

Note that I have not yet migrated `dhall-nix` in.  I'm waiting for
https://github.com/dhall-lang/dhall-nix/issues/17 to be fixed since
`dhall-nix` is incompatible with later versions of `megaparsec` due to
`hnix`.
2018-10-28 17:32:51 -07:00