2018-10-29 01:32:51 +01:00
|
|
|
# `dhall-haskell`
|
2016-12-05 05:04:50 +01:00
|
|
|
|
2018-12-03 17:30:30 +01:00
|
|
|
You will probably want to read the language-agnostic `README` here:
|
2016-12-05 05:04:50 +01:00
|
|
|
|
2018-12-03 17:30:30 +01:00
|
|
|
* [`dhall-lang` `README`](https://github.com/dhall-lang/dhall-lang/blob/master/README.md)
|
2016-12-05 05:04:50 +01:00
|
|
|
|
2018-12-03 17:30:30 +01:00
|
|
|
This repository focuses on the Haskell bindings to Dhall and contains
|
|
|
|
the following packages:
|
|
|
|
|
2018-12-05 17:25:54 +01:00
|
|
|
* [`dhall`](./dhall) - [![Hackage](https://img.shields.io/hackage/v/dhall.svg)](https://hackage.haskell.org/package/dhall)
|
2018-12-03 17:30:30 +01:00
|
|
|
* [`dhall-bash`](./dhall-bash) - [![Hackage](https://img.shields.io/hackage/v/dhall-bash.svg)](https://hackage.haskell.org/package/dhall-bash)
|
|
|
|
* [`dhall-json`](./dhall-json) - [![Hackage](https://img.shields.io/hackage/v/dhall-json.svg)](https://hackage.haskell.org/package/dhall-json)
|
|
|
|
* [`dhall-text`](./dhall-text) - [![Hackage](https://img.shields.io/hackage/v/dhall-text.svg)](https://hackage.haskell.org/package/dhall-text)
|
2018-10-20 18:27:16 +02:00
|
|
|
|
2018-12-03 17:30:30 +01:00
|
|
|
Navigate to each package's directory for their respective `README`s
|
2018-10-20 18:27:16 +02:00
|
|
|
|
2018-12-10 21:28:19 +01:00
|
|
|
## Pre-built binaries
|
|
|
|
|
|
|
|
You can download pre-built binaries for Windows and Linux on the release page:
|
|
|
|
|
|
|
|
* [`dhall-haskell` - Releases](https://github.com/dhall-lang/dhall-haskell/releases)
|
|
|
|
|
|
|
|
For OS X, use `brew` to install the desired package. For example:
|
|
|
|
|
|
|
|
```
|
|
|
|
$ brew install dhall-json
|
|
|
|
```
|
|
|
|
|
2018-11-06 14:42:23 +01:00
|
|
|
## Building from source
|
|
|
|
|
|
|
|
### [cabal](https://www.haskell.org/cabal)
|
|
|
|
|
2018-10-29 01:32:51 +01:00
|
|
|
You can build all of the packages by running:
|
2018-10-20 18:27:16 +02:00
|
|
|
|
2018-11-06 14:42:23 +01:00
|
|
|
```console
|
|
|
|
$ cabal new-build all
|
|
|
|
```
|
|
|
|
|
|
|
|
And each of them with `cabal new-build <package-name>`, for example:
|
|
|
|
|
|
|
|
```console
|
|
|
|
$ cabal new-build dhall
|
2016-12-05 05:04:50 +01:00
|
|
|
```
|
2018-11-06 14:42:23 +01:00
|
|
|
|
|
|
|
... or you can run `cabal new-build` within each package directory.
|
|
|
|
|
|
|
|
### [nix](https://nixos.org/nix/)
|
|
|
|
|
|
|
|
You can build all of the packages by running:
|
|
|
|
|
|
|
|
```console
|
2018-10-20 18:27:16 +02:00
|
|
|
$ nix-build
|
|
|
|
```
|
2016-12-05 05:04:50 +01:00
|
|
|
|
2018-10-29 01:32:51 +01:00
|
|
|
... or you can run `nix-build` within each package's respective directory to
|
|
|
|
build just that one package.
|
2016-12-05 05:04:50 +01:00
|
|
|
|
2018-12-03 17:30:30 +01:00
|
|
|
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.
|
|
|
|
|
|
|
|
You can develop any package by navigating to that package's directory and
|
|
|
|
running:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
$ 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`:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
$ cabal configure
|
|
|
|
$ cabal build
|
|
|
|
$ cabal test
|
|
|
|
```
|
|
|
|
|
2018-11-06 14:42:23 +01:00
|
|
|
### [stack](https://docs.haskellstack.org)
|
|
|
|
|
|
|
|
You can build all of the packages with
|
|
|
|
|
|
|
|
```console
|
|
|
|
$ stack build
|
|
|
|
```
|
|
|
|
|
|
|
|
And each of them with `stack build <package-name>`, for example:
|
|
|
|
|
|
|
|
```console
|
|
|
|
$ stack build dhall-json
|
|
|
|
```
|
|
|
|
|
2018-12-07 03:00:03 +01:00
|
|
|
## Build and serve the "Try Dhall" website
|
|
|
|
|
|
|
|
This is currently only supported for Nix on Linux
|
|
|
|
|
|
|
|
You can build the static assets by running:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
$ nix-build --attr try-dhall-static
|
|
|
|
```
|
|
|
|
|
|
|
|
For local testing you can open the generated `./result/index.html` directly in
|
|
|
|
your browser and everything will work except for relative imports of the
|
|
|
|
Prelude.
|
|
|
|
|
|
|
|
To also test imports you can build the `try-dhall-server` script which uses
|
|
|
|
`warp` to serve the static assets:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
$ nix-build --attr try-dhall-server
|
|
|
|
$ result/bin/try-dhall-server
|
|
|
|
Serving directory /nix/store/i7x86qs888rndrhvw92y69jd5xaji060-try-dhall-static on port 3000 with ["index.html","index.htm"] index files.
|
|
|
|
```
|
|
|
|
|
|
|
|
... and then open `http://localhost:3000` in your browser. You will then be
|
|
|
|
able to import things from the Prelude within your Dhall configuration using
|
|
|
|
a path like `http://localhost:3000/Prelude/List/map`. Similarly, if you host
|
|
|
|
this on some public-facing domain such as `https://try.dhall-lang.org` then you
|
|
|
|
can import the Prelude using `https://try.dhall-lang.org/Prelude/List/map`.
|
|
|
|
|
|
|
|
Note that imports from other domains (such as `prelude.dhall-lang.org`) will not
|
|
|
|
yet work since cross-origin resource-sharing (CORS) is not enabled. This is why
|
|
|
|
the "Try Dhall" server serves its own copy of the Prelude.
|
|
|
|
|
2018-12-03 17:30:30 +01:00
|
|
|
## Contributing
|
2018-10-20 18:27:16 +02:00
|
|
|
|
|
|
|
Read the following guide if you would like to contribute:
|
|
|
|
|
|
|
|
* [Contributing to Dhall](https://github.com/dhall-lang/dhall-lang/blob/master/.github/CONTRIBUTING.md)
|