Go to file
Frederik Ramcke 619788f795 dhall-lsp-server: Fix hovering in presence of nested lets (#1537)
* Fix hacked-together parsers

Back when we changed the linter to preserve let comments we made
whitespace parsing explicit (previously combinators swallowed any
trailing whitespace), but we forgot to update the hacked-together
parsers used by the LSP server. As a result, various convenience
features broke, but that's easy enough to fix.

* Fix 'annotate lets' and 'type on hover' features

Both features only work as intended if as much of the Dhall code as
possible is wrapped in Note annotations, since we use that to figure out
where the user was pointing. Since the removal of explicit multi-lets in
the syntax the parser no longer wraps immediately nested lets (i.e.
multilets) in Notes, which means we need to split them manually (like we
used to).

* Fix hovering test

Now the behaviour expected by the test matches what we would want in
reality.
2019-11-20 17:02:06 +00:00
dhall Improved error messages. (#1528) 2019-11-19 08:04:15 -08:00
dhall-bash Add `Integer/{clamp,negate}` built-ins (#1486) 2019-10-29 17:21:00 +00:00
dhall-json dhall-json: Don't normalize schema type before type-checking (#1555) 2019-11-19 00:30:01 +00:00
dhall-lsp-server dhall-lsp-server: Fix hovering in presence of nested lets (#1537) 2019-11-20 17:02:06 +00:00
dhall-nix Add `Integer/{clamp,negate}` built-ins (#1486) 2019-10-29 17:21:00 +00:00
dhall-text Replace `dhall-to-text` with `dhall text` subcommand (#1090) 2019-07-08 17:18:09 +00:00
dhall-try Strip trailing whitespace (#1422) 2019-11-14 14:43:35 +01:00
dhall-yaml Move HsYAML-based code to new package dhall-yaml (#1514) 2019-11-07 12:11:04 +00:00
nix Strip trailing whitespace (#1422) 2019-11-14 14:43:35 +01:00
scripts Move HsYAML-based code to new package dhall-yaml (#1514) 2019-11-07 12:11:04 +00:00
.gitignore Fix default cache handling in windows (#1272) 2019-09-16 09:51:00 +02:00
.gitmodules Use git submodule to obtain official Prelude and test suite (#787) 2019-01-19 09:09:34 -08:00
.mergify.yml Mergify: Add "merged" condition for "delete_head_branch" action (#1089) 2019-07-08 04:20:47 +02:00
.travis-functions.sh Build macOS binaries with Travis (#1101) 2019-07-15 09:43:59 +03:00
.travis.yml Move HsYAML-based code to new package dhall-yaml (#1514) 2019-11-07 12:11:04 +00:00
CODE_OF_CONDUCT.md Add Code of Conduct (#1523) 2019-11-13 19:36:03 -08:00
LICENSE Migrate `dhall-{bash,json,text}` into this repository (#661) 2018-10-28 17:32:51 -07:00
README.md README: Include Hackage link for dhall-lsp-server (#1520) 2019-11-07 17:48:38 +00:00
appveyor.yml Move HsYAML-based code to new package dhall-yaml (#1514) 2019-11-07 12:11:04 +00:00
cabal.project Strip trailing whitespace (#1422) 2019-11-14 14:43:35 +01:00
default.nix Move HsYAML-based code to new package dhall-yaml (#1514) 2019-11-07 12:11:04 +00:00
release.nix Move HsYAML-based code to new package dhall-yaml (#1514) 2019-11-07 12:11:04 +00:00
shell.nix Move HsYAML-based code to new package dhall-yaml (#1514) 2019-11-07 12:11:04 +00:00
stack-lts-6.yaml Strip trailing whitespace (#1422) 2019-11-14 14:43:35 +01:00
stack.yaml Strip trailing whitespace (#1422) 2019-11-14 14:43:35 +01:00

README.md

dhall-haskell

You will probably want to read the language-agnostic README here:

This repository focuses on the Haskell bindings to Dhall and contains the following packages:

Navigate to each package's directory for their respective READMEs

Pre-built binaries

You can download pre-built binaries for Windows, OS X and Linux on the release page:

You can also install binaries for OS X using brew, like this:

$ brew install dhall-json

You can also install pre-built Linux binaries for master using Nix using Nix's channel mechanism by following the instructions at this link:

To install the Nix build products without a channel, configure your machine to use cache.dhall-lang.org, as described in the nix section and then visit one of the following links:

You can then click the "Help" button in the bottom right corner, which will show you a nix-env command that you can run to install the prebuilt executable.

If you have the jq command-line tool installed then you can do this in one command by running:

$ nix-env -i "$(curl -L https://hydra.dhall-lang.org/job/dhall-haskell/master/linux-dhall/latest/api/get-info | jq -r .outPath)"

These instructions also work for any pull request, too, by replacing master with the pull request number for any of the above URLs.

Pre-built containers

Prebuilt containers for the latest release available from Docker Hub:

... but if you want to obtain containers for bleeding-edge builds, you can download image archives for each package using the following URLs:

You can then load and run one of these archives like so:

$ NAME="dhall"

$ curl --location --remote-name "https://hydra.dhall-lang.org/job/dhall-haskell/master/image-${NAME}/latest/download/1/docker-image-${NAME}.tar.gz"

$ docker load < "docker-image-${NAME}.tar.gz"
...
Loaded image: dhall:vx95jiijmp2i07f5ynl8h6sllf34jggz

$ docker run -i dhall:vx95jiijmp2i07f5ynl8h6sllf34jggz dhall <<< '2 + 2'
4

These instructions also work for any pull request, too, by replacing master with the pull request number for any of the above URLs.

Building from source

For all of the following instructions, make sure to first check out the dhall-lang submodule:

$ git submodule init
$ git submodule update

cabal

You can build all of the packages by running:

$ cabal new-build all

And each of them with cabal new-build <package-name>, for example:

$ cabal new-build dhall

... or you can run cabal new-build within each package directory.

nix

You will probably want to use the shared cache hosted at cache.dhall-lang.org when doing Nix development. This is not required, but this will save you a lot of time so that you don't have to build as many dependencies from scratch the first time.

If your operating system is NixOS then you can add the cache using these NixOS configuration options to access dhall packages from your declarative configuration file:

  nix = {
    binaryCaches = [ "https://cache.nixos.org" "https://cache.dhall-lang.org" ];

    binaryCachePublicKeys = [
      "cache.dhall-lang.org:I9/H18WHd60olG5GsIjolp7CtepSgJmM2CsO813VTmM="
    ];
  };

If you want to install these packages imperatively using nix-env, regardless of whether you use NixOS, set the following options in your /etc/nix/nix.conf file.

Using Nix 2.0 or later:

trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= cache.dhall-lang.org:I9/H18WHd60olG5GsIjolp7CtepSgJmM2CsO813VTmM=
substituters = https://cache.nixos.org https://cache.dhall-lang.org

Using earlier Nix versions (i.e. Nix 1.*):

binary-cache-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= cache.dhall-lang.org:I9/H18WHd60olG5GsIjolp7CtepSgJmM2CsO813VTmM=
binary-caches = https://cache.nixos.org https://cache.dhall-lang.org

You can build all of the packages by running:

$ nix-build

... or you can run nix-build within each package's respective directory to build just that one package.

You can install all of the packages by running:

$ nix-env --install --file default.nix

... or you can run the same command within each package's respective directory to install just that one package.

If you prefer installing the binaries locally in a nix shell environment instead, just run nix-shell in the top-level directory. This option provides additional flexibility with respect to overriding some of the default parameters e.g. the compiler version, which makes it particularly useful for developers.

You can develop any package by navigating to that package's directory and running:

$ nix-shell
[nix-shell]$ cabal configure
[nix-shell]$ cabal build
[nix-shell]$ cabal test

... or you can add nix: True to your ~/.cabal/config file and then you can run the same cabal commands without an explicit nix-shell:

$ cabal configure
$ cabal build
$ cabal test

stack

You can build all of the packages with

$ stack build

And each of them with stack build <package-name>, for example:

$ stack build dhall-json

Profiling

Say you want to profile the dhall-to-json executable.

Build the containing package with profiling options:

$ stack build --profile --library-profiling dhall-json

Run the executable on your input. For example:

$ stack exec --profile --rts-options -p -- dhall-to-json <<< 'True && False'

This generates a dhall-to-json.prof file in your current directory.

Build the website

Building the website from source is currently only supported for Nix on Linux.

You can build the static assets by running:

$ nix-build --attr website

... then open ./result/index.html in your browser.

You can also download an archive containing the pre-built website from CI using this link:

Contributing

Read the following guide if you would like to contribute: