dhall-haskell/dhall
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
..
Prelude Update standard version to 5.0.0 in Binary.hs (#771) 2018-12-31 10:48:17 -06:00
benchmark Add Unordered Map Traversal (#749) 2018-12-10 10:46:46 -08:00
dhall Migrate `dhall-{bash,json,text}` into this repository (#661) 2018-10-28 17:32:51 -07:00
doctest Fix test errors in windows caused by encoding (#782) 2019-01-16 19:15:57 -08:00
examples Migrate `dhall-{bash,json,text}` into this repository (#661) 2018-10-28 17:32:51 -07:00
src Don't disable `-fwarn-incomplete-uni-patterns` at module level (#784) 2019-01-18 07:13:49 -08:00
tests Fix non-exhaustive pattern match in `dhall lint` (#780) 2019-01-16 21:59:11 -08:00
CHANGELOG.md Version 1.20.0 → 1.20.1 (#773) 2019-01-05 18:51:33 -08:00
LICENSE Migrate `dhall-{bash,json,text}` into this repository (#661) 2018-10-28 17:32:51 -07:00
README.md Version 1.19.1 → 1.20.0 (#767) 2018-12-29 11:48:21 -06:00
Setup.hs 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.cabal Fix non-exhaustive pattern match in `dhall lint` (#780) 2019-01-16 21:59:11 -08:00
shell.nix Migrate `dhall-{bash,json,text}` into this repository (#661) 2018-10-28 17:32:51 -07:00

README.md

dhall

For installation or development instructions, see:

Full documentation here:

Introduction

Dhall is a programmable configuration language that is not Turing-complete

You can think of Dhall as: JSON + functions + types + imports

Motivation

"Why not configure my program using JSON or YAML?"

JSON or YAML are suitable for small configuration files, but larger configuration files with complex schemas require programming language features to reduce repetition. Otherwise, the repetitive configuration files become error-prone and difficult to maintain/migrate.

This post explains in more detail the motivation behind programmable configuration files:

"Why not configure my program using Haskell code?"

You probably don't want to rebuild your program every time you make a configuration change. Recompilation is slow and requires the GHC toolchain to be installed anywhere you want to make configuration changes.

Example

Given this Haskell program saved to example.hs:

-- example.hs

{-# LANGUAGE DeriveGeneric     #-}
{-# LANGUAGE OverloadedStrings #-}

import Dhall

data Example = Example { foo :: Integer, bar :: Vector Double }
    deriving (Generic, Show)

instance Interpret Example

main :: IO ()
main = do
    x <- input auto "./config"
    print (x :: Example)

... which reads in this configuration file:

$ cat ./config
{ foo = 1
, bar = ./bar
}

... which in turn references this other file:

$ cat ./bar
[3.0, 4.0, 5.0]

... you can interpret the Haskell program like this:

$ nix-shell ../nix/test-dhall.nix
[nix-shell]$ runghc example.hs
Example {foo = 1, bar = [3.0,4.0,5.0]}

You can also interpret Dhall programs directly using the installed command-line compiler:

$ dhall
List/head Double ./bar
<Ctrl-D>
Optional Double

Some 3.0

... and you can reference remote expressions or functions by their URL, too:

$ dhall
let null = https://raw.githubusercontent.com/dhall-lang/Prelude/35deff0d41f2bf86c42089c6ca16665537f54d75/List/null
in  null Double ./bar
<Ctrl-D>
Bool

False

Now go read the Dhall tutorial to learn more.