dhall-haskell/dhall-bash
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
..
exec Migrate dhall-{bash,json,text} into this repository (#661) 2018-10-28 17:32:51 -07:00
src/Dhall Migrate dhall-{bash,json,text} into this repository (#661) 2018-10-28 17:32:51 -07:00
default.nix Migrate dhall-{bash,json,text} into this repository (#661) 2018-10-28 17:32:51 -07:00
dhall-bash.cabal Migrate dhall-{bash,json,text} into this repository (#661) 2018-10-28 17:32:51 -07:00
LICENSE Migrate dhall-{bash,json,text} into this repository (#661) 2018-10-28 17:32:51 -07:00
README.md Migrate dhall-{bash,json,text} into this repository (#661) 2018-10-28 17:32:51 -07:00
Setup.hs Migrate dhall-{bash,json,text} into this repository (#661) 2018-10-28 17:32:51 -07:00
shell.nix Migrate dhall-{bash,json,text} into this repository (#661) 2018-10-28 17:32:51 -07:00

dhall-bash 1.0.16

Hackage

This dhall-bash package provides a Dhall to Bash compiler so that you can easily marshall Dhall values into your Bash scripts

This does not compile all available Dhall language constructs into Bash and only supports extracting primitive values, lists, optional values and records from normalized expressions.

Quick start

If you have Nix installed, then you can build and install this package using:

$ nix-env --install --file default.nix
$ dhall-to-bash <<< '1'
1
$ dhall-to-bash <<< '"ABC" ++ "DEF"'
ABCDEF
$ dhall-to-bash --declare FOO <<< '"ABC" ++ "DEF"'
declare -r FOO=ABCDEF
$ eval $(dhall-to-bash --declare FOO <<< '"ABC" ++ "DEF"')
$ echo "${FOO}"
ABCDEF
$ dhall-to-bash --declare BAR
let replicate = https://ipfs.io/ipfs/QmcTbCdS21pCxXysTzEiucDuwwLWbLUWNSKwkJVfwpy2zK/Prelude/List/replicate
in  replicate +10 Integer 1
<Ctrl-D>
declare -r -a BAR=(1 1 1 1 1 1 1 1 1 1)
$ dhall-to-bash --declare BAZ <<< '{ qux = 1, xyzzy = True }'
declare -r -A BAZ=([qux]=1 [xyzzy]=true)