Commit Graph

22 Commits

Author SHA1 Message Date
Gabriel Gonzalez 90b62ee9d7 Replace `dhall-to-text` with `dhall text` subcommand (#1090)
Fixes #1087
2019-07-08 17:18:09 +00:00
Clément Delafargue b9aeb345e4 Make the type of extract richer (#1011)
see #387
2019-06-24 07:22:35 -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
quasicomputational 48c73f3ef9 Add and expose genericInject. (#940)
This is a counterpart to `genericAuto`, which is useful for dealing
with types coming from a library without orphan instances.
2019-05-05 20:21:50 -07:00
Gabriel Gonzalez a929d4e0bb
Fix marshalling of unions (including enums) in and out of Dhall (#936)
Fixes https://github.com/dhall-lang/dhall-haskell/issues/930
2019-05-04 22:29:51 -07:00
quasicomputational c9ea8b99ca Teach genericAuto about new-style union construction. (#927)
The underlying bug is very similar to #915, and in fact this builds on
the fix for that in #918.

Closes #926.
2019-05-02 09:26:53 -07:00
klntsky 962a172b53
Converted sample code to doctest for `RecordType`, `UnionInputType`, `RecordInputType` 2019-05-01 09:52:43 +03:00
Gabriel Gonzalez 07c9c62af3
Fix marshaling new-style union literals (#918)
Fixes https://github.com/dhall-lang/dhall-haskell/issues/915
2019-04-30 08:18:12 -07:00
Gabriel Gonzalez 7d31506be4
Automatically discover tests (#897)
This adds a new `Dhall.Test.Util.discover` utility for auto-generating
a `TestTree` from a directory tree.  This simplifies keeping up to date
with changes to the standard test suite.
2019-04-24 13:01:46 -07:00
AndrasKovacs fcca883e00 Add a new environment machine normalizer (#876)
- Dhall.Eval: new evaluator, conversion checker and normalizer.
  There is no standalone alpha normalizer yet.
- There is a new option "new-normalize" for dhall executable, which uses
  the new normalizer.
- Type checker is unchanged.
- new implementation: alphaNormalize, judgmentallyEqual, normalize
- normalizeWith takes a Maybe ReifiedNormalizer argument now, and switches to
  the new evaluator whenever the input normalizer is Nothing
- QuickCheck test for isNormalized removed, because we don't support evaluation
  of ill-typed terms, which the test would require.
2019-04-17 16:41:04 -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
Justin Le 35513e715a Fix for UnionType (#857)
Fix the type equality check by using judgmental equality
2019-03-16 10:12:55 -07:00
Javier Neira d714754e14 Show some details in InvalidType error output (#824) 2019-02-23 09:49:14 -08:00
Gabriel Gonzalez 96d34ee92a
Don't disable `-fwarn-incomplete-uni-patterns` at module level (#784)
... as suggested by @ocharles in
c368d66a6f (commitcomment-31973007)

Instead, explicitly opt out more narrowly with `unsafeExpect*` functions
2019-01-18 07:13:49 -08:00
Gabriel Gonzalez f24f665047
Fix non-exhaustive pattern match in `dhall lint` (#780)
`dhall lint` would fail on the following expression:

```
    let replicate = https://prelude.dhall-lang.org/List/replicate

in  let Config = { name : Text, age : Natural }

in  let Configs = List Config

in  replicate 10 Text "!"
```

... because the code (incorrectly) assumed that simplifying an inner
`let` binding would preserve at least one `let` binding.  However, when the
outer `let` (beginning with `let replicate`) is simplified the inner `let`
(beginning with `let Config`) simplifies down to just `replicate 10 Text "!"`
which has no `let` binding at all, leading to a pattern match failure.

This change fixes that by extending the code to correctly handle that case
with an exhaustive pattern match.
2019-01-16 21:59:11 -08:00
Gabriel Gonzalez f5928e4472
Fix Nix build to reinstate `-Werror` (#781)
A refactor of the Nix build accidentally removed the `-Werror` flag, which
caused some warnings to get past CI.  This change fixes that and removes the
warnings.
2019-01-16 19:39:51 -08:00
Justin Le ec48c20f04 `UnionType` and `UnionInputType`, analogues of `RecordType` and `RecordInputType` (#775) 2019-01-15 16:55:56 -08:00
Gabriel Gonzalez 162dde95ac
Add `inputNormalizer` field to `InterpretOptions` (#777)
This fixes the problem found in https://github.com/dhall-lang/dhall-lang/issues/166#issuecomment-452766374

This ensures that the functions marshalled into Haskell can correctly take
advantage of user-supplied language extensions
2019-01-11 08:29:40 -08:00
Adam Sandberg Eriksson 026db247f7 Fix haddock syntax (#761) 2018-12-19 07:19:07 -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
Alexander Biehl 096c03936e Introduce normalizeWithM for monadic normalization (#371) 2018-11-05 20:21:29 -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