Commit Graph

95 Commits

Author SHA1 Message Date
Gabriel Gonzalez 462f82a0f8 Build against `optparse-applicative-0.15` (#1081)
Related to https://github.com/commercialhaskell/stackage/issues/4693
2019-07-07 11:49:11 +00:00
Gabriel Gonzalez b8e19d614a Fix `dhall-json`'s support for preserving alternative names (#1080)
* Fix `dhall-json`'s support for preserving alternative names

... as caught by @sjakobi in the course of #1077

The code has to be updated to reflect the new normal forms for
union literals

* Add tests

... as suggested by @sjakobi
2019-07-07 10:27:54 +00:00
Simon Jakobi 76efe630b2 Remove cruft related to the removed 'constructors' keyword (#1077) 2019-07-06 22:38:02 +00: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
Simon Jakobi 157c36b8a1 dhall-json: Use Dhall.Optics instead of lens (#1042)
This removes the following packages from `dhall-json`'s dependencies:

- adjunctions
- call-stack
- free
- invariant
- kan-extensions
- lens
- parallel
- reflection
- transformers-base
- void

* Fix bound on dhall
2019-06-29 14:58:17 -07:00
Gabriel Gonzalez da085435c1
Add `dhall-json` support for weakly-typed JSON values (#1007)
Fixes https://github.com/dhall-lang/dhall-lang/issues/409

This matches the standard representation for arbitrary JSON proposed in
https://github.com/dhall-lang/dhall-lang/pull/586
2019-06-19 18:19:37 -07:00
Javier Neira 95dc3daae8 Eta support for dhall-json (#1013)
After #989 and #993 the use of the `yaml` package is isolated in the lib modules `Dhall.Yaml` and `Dhall.YamlToDhall` so it is easier to add support for compilers that cant use the `yaml`package like eta or ghcjs.

With this one we would add support for [eta](https://eta-lang.org/), a fork of ghc that compiles to jvm bytecode.

Main changes:

* Add conditional to cabal file and cpp conditions to the main modules for yaml to use a specific module for eta, `Dhall.Yaml.Eta` that replaces calls to the `yaml`package to ffi calls to the java lib [jackson](https://github.com/FasterXML/jackson), one of the most popular ones in the java world.
* Add the java files that contains the ffi calls
* Mark  `buildable: False` the subpackages that cant be built by eta for now

One effect of use the cabal file for cabal and etlas (the build tool for eta) is stack and cabal builds show those warnings:

```
Warning: Cabal file warning in D:\ws\eta\dhall\dhall-haskell\dhall-json\dhall-js
on.cabal@ 69:9:
         Unknown field: "maven-depends"

Warning: Cabal file warning in D:\ws\eta\dhall\dhall-haskell\dhall-json\dhall-js
on.cabal@ 74:9:
         Unknown field: "java-sources"
```

I've not found a way to avoid them other than use another file for etlas build (`etlas.dhall`). It would suppose duplicate most of the logic, though.
2019-06-18 17:45:01 -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 6748d15584
Fix `dhall-json` test failure (#997)
Fixes https://github.com/dhall-lang/dhall-haskell/issues/996

This enables the test suite for `dhall-json` and also ensures that
all packages are built using the source distribution (to catch
missing `extra-files`)
2019-06-09 08:17:07 -07:00
Javier Neira 56264270e4 Another step in isolate yaml and prepare for HsYaml replacement (#993) 2019-06-07 20:26:05 -07:00
Gabriel Gonzalez fc5b382238
Version 1.23.0 → 1.24.0 (#984) 2019-06-06 17:14:43 -07:00
Javier Neira 1d3f3d32fe [dhall-json] Isolate yaml usage behind `Dhall.Yaml` (#989) 2019-06-05 08:01:55 -07:00
Gabriel Gonzalez 98c7d4dfca
Support older `yaml` versions (#981)
Fixes https://github.com/dhall-lang/dhall-haskell/issues/969
2019-06-02 14:16:47 -07:00
Javier Neira 2a37b2e7bf Bump up lower bound of aeson-pretty (#978) 2019-06-01 07:10:38 -07:00
Robbie McMichael 6ec28cda27 Use json-to-dhall to implement yaml-to-dhall (#977) 2019-05-30 08:54:35 -07:00
quasicomputational f61a3f2fb1
dhall-json: fix yaml dependency. (#962)
In yaml-0.11, Text.Libyaml was split into the libyaml package. Hence,
as dhall-json imports that module, a libyaml dependency is needed when
yaml >= 0.11. This necessitates an automatic flag.
2019-05-23 13:27:41 +01:00
Gabriel Gonzalez 8139c3678c
Change YAML/JSON encoding for `NaN`/`Infinity`/`-Infinity` (#946)
Before, `dhall-to-json`/`dhall-to-yaml` would use approximate
representations for special `Double` values.  Specifically, `NaN`
would encode as `null` and `±Infinity` would encode as the minimum
and maximum `Double` values.

After this change, YAML will now use `nan`/`inf`/`-inf` to encode
these values (since special `Double` values are natively supported
by YAML) and the JSON encoding will reject them by default.  The
user can restore the old behavior for the JSON encoding by enabling
the `--approximate-special-doubles` flag.
2019-05-12 16:04:25 -07:00
Dmitry Dolgov 07906673af [POC] Add 'quoted' option (#941)
Allow to generare quoted scalars if needed via providing a custom encode
options to Data.Yaml.encodeWith. So far two corner cases from yaml
itself (an empty scalar, and special strings) are omitted in the
implementation.
2019-05-12 07:44:12 -07:00
Gabriel Gonzalez bf4349ef7a
Version 1.22.0 → 1.23.0 (#943) 2019-05-11 13:03:42 -07:00
Gabriel Gonzalez f7fecda09d
Version 1.21.0 → 1.22.0 (#910) 2019-04-27 20:17:34 -07:00
Profpatsch 86ceb825cd dhall-json: Rephrase error message when decoding a bare `None` (#900)
Co-Authored-By: Profpatsch <mail@profpatsch.de>
2019-04-23 08:43:00 -07:00
Gabriel Gonzalez 1f40b633d6
Add a better error message when decoding a bare `None` (#895)
Fixes #492
2019-04-19 09:30:05 -07:00
Javier Neira 91f3cae1bf Add json-to-dhall to appveyor artifacts (#894)
* Add json-to-dhall to dhall-json artifact

* Make json-to-dhall buildable with ghc-7.10

* Remove commented buildable field

* Remove unused import Semigroup
2019-04-16 12:52:55 +02:00
antislava c52ae96a0b
json-to-dhall initial implementation (#884)
* Initial draft of the json-to-dhall tool

* Homogenous JSON maps -> Dhall association lists. Bower example.

* Default conversion options. Ghci examples in function annotations.

* Added type signature to text color highlighting functions (error
reporing)

* Removed TypeApplications extension

* Explicit semigroups

* Disable ghc < 8.0 build

* Type specifications for 'None's (e.g. None Integer instead of just None)

* New style for unions, e.g.: < Left : Text | Right : Integer >.Right +1
2019-04-15 01:21:38 +02:00
Fabrizio Ferrai e44a6e0055 Also omit empty arrays with --omitEmpty (#872) 2019-03-30 09:43:48 -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 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 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 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
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
Gabriel Gonzalez 6a70f133a1
Version 1.19.1 → 1.20.0 (#767) 2018-12-29 11:48:21 -06:00
Gabriel Gonzalez 615eccb10d
Expand main page with high-level reasons to adopt Dhall (#754)
This adds four new sections to the page after the live demo which highlight
the common themes that I notice people use when communicating the value of
Dhall to others on social media:

* The first section emphasizes the element of delight in using the language for
  people who are into elegance and quality

* The second section focuses on more pragmatic people who are sick of YAML and
  just want a reasonable alternative that they can convince their manager to
  adopt

* The third section appeals to the LangSec crowd that wants an uncompromising
  and secure foundation for what they are buliding

* The last section targeted at the skeptic who thinks that Dhall is an ivory
  tower language not suited for real-world problems.

The second crowd (YAML emigrants) is the audience that I'm targeting the
most strongly at the moment, but I didn't want to lead with a negative reason
adopt by focusing on the limitations of YAML, so I put the section on delight
first so that we could start with a more positive tone.
2018-12-13 06:44:33 -08:00
Gabriel Gonzalez d7d8139d39
Expand "Try dhall" into `dhall-lang.org` home page (#747)
This expands the "Try dhall" page to serve as a functional home page for
"dhall-lang.org" in the short term by making the following changes:

* Adding a navigation bar to the top that links to useful resources and
  official integrations
* Adding a quick summary explaining what Dhall is
2018-12-10 12:28:19 -08:00
Gabriel Gonzalez db6f80fec2
Add `--compact` flag to `dhall-to-json` (#743)
This is phase 1 of transitioning to pretty-printing by default, as
described here:

https://github.com/dhall-lang/dhall-haskell/issues/716#issuecomment-445485153

This flag allows users who prefer the compact format a smooth migration
path
2018-12-09 08:17:33 -08:00
Gabriel Gonzalez 9148b35aba
Build against `tasty-1.2` (#731)
Related to https://github.com/commercialhaskell/stackage/issues/4196
2018-12-03 08:48:43 -08:00
Gabriel Gonzalez 7dd6b76d04
Update `README`s (#732)
This updates all of the `README`s to:

* centralize all of the build/install/develop information in the
  top-level `README`
* get the nested `README`s to use a consistent style
2018-12-03 08:30:30 -08:00
Justin Woo f3d26e5f32 add --version to dhall-json (#704) 2018-11-24 08:35:58 -08:00
Gabriel Gonzalez 53ae87c8e2
Version 1.18.0 → 1.19.0 (#691) 2018-11-21 19:10:32 -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 5b2ee41386
Build against `yaml-0.11.0.0` (#689) 2018-11-17 08:28:06 -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
Javier Neira 5db1051311 Update stack/cabal config to sync with new structure (#671)
Also, add build instructions for cabal and stack in alphabetical order
2018-11-06 05:42:23 -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