Commit Graph

414 Commits

Author SHA1 Message Date
Gabriel Gonzalez
3b357aa806 Version 1.5.0 => 1.5.1 2017-08-02 20:07:27 -07:00
Gabriel Gonzalez
6947b05a9c Fix dhall to build against Stackage lts-9.0 2017-08-02 20:05:26 -07:00
bosu
333fc1d000 Export InputType (#91) 2017-07-27 11:44:37 -07:00
Gabriel Gonzalez
12ad893605 Version 1.4.2 => 1.5.0 2017-07-25 20:11:53 -07:00
Gabriel Gonzalez
8b3ebbc832 Remove use of Template Haskell. Fixes #89
This replaces all uses of `NeatInterpolation` with either multi-line
strings or `unlines`.  This allows Dhall to be compiled without using
Template Haskell, which in turn enables cross-compilation
2017-07-25 19:51:40 -07:00
Gabriel Gonzalez
85f63f548f Add (#) operator to append two lists. Fixes #68 (#90) 2017-07-25 07:44:13 -07:00
Gabriel Gonzalez
fae3232480 Add support for marshaling simple Dhall functions to Haskell functions (#88) 2017-07-22 04:53:24 -07:00
Gabriel Gonzalez
de80063698 Revert "Overload (++) to work on Lists. Fixes #68 (#81)"
This reverts commit 8c340c12dd.

The reason for reverting this change is that using the same
operator name for appending `Text` and `List`s complicates
compilation to other languages.  For example, the `dhall-to-nix`
compiler currently translates `TextAppend` to `+`, but if you
consolidate `List` and `Text` append under a single `Append`
constructor then the translation to Nix is harder: you'd have to
do type inference as part of the translation process to know which
Nix operator to translate to.
2017-07-15 13:47:17 -07:00
Gabriel Gonzalez
b350b06436 Simplify IPFS deployment 2017-07-13 22:10:17 -07:00
Gabriel Gonzalez
133fe11e2f Add instructions for hosting IPFS mirror 2017-07-13 19:36:30 -07:00
Gabriel Gonzalez
b59228bd95 Add NixOps deployment for Dhall IPFS mirror 2017-07-13 19:30:03 -07:00
bosu
0221dd4432 Exports Type internals. (#86)
Adds trivial comments on extend, extract functions.

Fixes https://github.com/Gabriel439/Haskell-Dhall-Library/issues/26.
2017-07-11 14:04:44 -07:00
Gabriel Gonzalez
8c340c12dd Overload (++) to work on Lists. Fixes #68 (#81) 2017-07-07 11:13:03 -07:00
Ville Tirronen
28179ceb76 Added normalizeWith function. (#79)
Added `normalizeWith` function to complement `typeWith`.
Dhall is so very attractive base for simple DSLs that I felt it
needed to be pushed over the edge.

Naturally, using `normalizeWith` loses all the nice features of Dhall.
If your context isn't total or strongly normalizing then embedding it
to Dhall will not improve things.
2017-07-05 09:12:41 -07:00
Ville Tirronen
94d6f4da74 Added a loadWith function. (#84)
This allows loading dhall 'modules' using a custom typing
context. See #83
2017-07-05 09:06:50 -07:00
Ville Tirronen
4707a8ff62 Raw input (#85)
Added a function that allows doing `input` from a closed
Dhall `Expr` instead of text. This is hugely useful when
working with Dhall in AST level (for example, using custom
types / normalization). For example, suppose that you have
built a custom primitive that requires a record as an argument.
With `rawInput` you can just extract the record into a Haskell
data type and process it without need to work with maps and other
bits of AST.

For context of this commit, see #79 (and also #26).
2017-07-05 09:05:47 -07:00
Chris Martin
7a0c03df57 add Type and Interpret instance for strict Text (#82) 2017-07-01 22:24:39 -07:00
Gabriel Gonzalez
40478ccb89 Mention dhall-text in README 2017-06-19 18:27:50 -07:00
Gabriel Gonzalez
afb645faa5 Version 1.4.1 => 1.4.2 2017-06-17 13:32:19 -07:00
Gabriel Gonzalez
3d47ddcc83 Add missing Prelude files to Extra-Source-Files
This fixes build failures in Dhall package archives downloaded from
Hackage
2017-06-17 13:30:48 -07:00
Gabriel Gonzalez
51f05ca422 Version 1.4.0 => 1.4.1 2017-06-17 13:13:42 -07:00
Gabriel Gonzalez
42d5acf9c8 Add tests/Tutorial.hs module to the cabal package
This fixes a test failure for builds from Hackage due to the module not
being included in the package archive
2017-06-17 13:12:20 -07:00
Gabriel Gonzalez
a744bd0b6b Version 1.3.0 => 1.4.0 2017-06-17 12:36:12 -07:00
Gabriel Gonzalez
c3cb188e53 Rearrange detailed error messages (#76)
This rearranges each detailed error message so that the summary of relevant
Dhall expressions goes at the end of the message.  This allows users to easily
obtain this information without having to browse the entire error message.
2017-06-17 12:20:45 -07:00
Gabriel Gonzalez
0873c6efc6 Update Prelude hash 2017-06-17 09:56:30 -07:00
Gabriel Gonzalez
2d7fe03ae0 Expand ./Prelude/Optional (#77)
This adds several new list-like utilities, such as `any`/`null`/`length`
2017-06-17 09:44:42 -07:00
Gabriel Gonzalez
2b8b89e41a Add ./Prelude/Text/concatMap (#73) 2017-06-17 09:05:48 -07:00
Gabriel Gonzalez
000fb8ebc4 Add using as reserved identifier 2017-06-17 09:01:06 -07:00
Gabriel Gonzalez
33b4fcec78 Add concatMapSep (#75) 2017-06-17 08:49:27 -07:00
Gabriel Gonzalez
5afee37868 Rename intercalate to concatSep (#74)
This uses Nix's naming convention for consistency
2017-06-17 08:49:04 -07:00
Gabriel Gonzalez
45a7f8cbb7 Add support for additional headers for URL imports. Fixes #45 (#71)
Users can now supply additional headers for URL imports using the new `using`
keyword, like this:

```haskell
http://example.com using ./headers
```

... where `./headers` must be a value of type:

```haskell
{ header : Text, value : Text }
```

The argument to `using` must be an import (such as a file, URL, or env import)
and cannot be an inline Dhall expression.  There are two reasons why:

* The header expression is resolved, type-checked, and normalized in a separate
  phase preceding the import of the corresponding URL so it does not have access
  to bound variables in scop
* This restriction greatly simplifies the implementation

Also, headers are automatically forwarded to relative imports, so if you import a
URL like this:

```haskell
http://example.com using ./headers
```

... and that serves a file like:

```haskell
./foo
```

... then Dhall will import `http://example.com/foo` using the same `./headers`.
2017-06-17 07:14:37 -07:00
Gabriel Gonzalez
b5d54860a4 Fix missing haddock documentation (#69) 2017-06-16 17:30:44 -07:00
Gabriel Gonzalez
8a7058200b Fix import bug when canonicalizing paths with home directories (#70)
Before this change, if you saved the following files:

```bash
$ echo "~/bar" > /tmp/foo
$ echo "./baz" > ~/bar
$ echo "1"     > ~/baz
```

... then you would get the following error:

```bash
$ dhall <<< '/tmp/foo'

↳ ./foo
  ↳ ~/.bar
    ↳ ./baz

Error: Missing file
```

This is because path canonicalization had a bug where relative directories like
`./baz` do not get correctly resolved relative to home-anchored directories like
`~/.bar`.  The compiler instead mistakenly tried to locate a non-home-anchored
`./baz` file, which does not exist.

After this fix, the above code resolves correctly tries to resolve `~/baz` as
the last file in the import chain and succeeds with:

```bash
$ dhall <<< '/tmp/foo'
Integer

1
```
2017-06-16 17:30:32 -07:00
Gabriel Gonzalez
98b57f6970 Add Prelude/Text/intercalate (#65)
Interspersing a separator in between string elements is sufficiently
tricky that there should be a utility to do this
2017-06-15 19:51:30 -07:00
Gabriel Gonzalez
a6ee2d531e Make merge type annotation optional (#66)
You can now omit the type annotation on `merge`s so long as the union
being merged has at least one alternative
2017-06-15 19:50:43 -07:00
Bartosz Nitka
daad343111 Relax bound on trifecta for GHC 8.2 (#67)
trifecta-1.7 is the first version of trifecta
that builds with GHC 8.2 and Cabal 2.0
2017-06-15 06:13:53 -07:00
Gabriel Gonzalez
8e223b1d61 Fix escaping rules for ${ to match Nix (#63)
Nix actually uses two single quotes to escape `${` instead of one single quote
2017-06-06 08:32:52 -07:00
Gabriel Gonzalez
c15eebf935 Add support for string interpolation. Fixes #47 (#60)
You can now interpolate any expression of type `Text` into a string literal,
like this:

```haskell
let renderRating
    =   λ(rating : { name : Text, rating : Natural })
    →   let score = Integer/show (Natural/toInteger rating.rating)
    in  ''
        # My thoughts about ${rating.name} (${score} out of 5)
        ''
in  renderRating { name = "Dhall", rating = +6 }
```
2017-05-22 10:40:07 -07:00
Gabriel Gonzalez
c12ff1cb67 Version 1.2.0 => 1.3.0 2017-05-17 09:09:41 -07:00
Gabriel Gonzalez
e06791c6c1 Update default.nix 2017-05-17 09:04:42 -07:00
Gabriel Gonzalez
4c69a50484 Update tutorial for latest Prelude (#59)
I've uploaded the latest Prelude to IPFS and updated the tutorial to reflect
the changes (mostly the change in the derived IPFS hash)
2017-05-17 08:31:51 -07:00
Gabriel Gonzalez
e0319ecaa5 Forbid additional characters from paths (#58)
This reduces the number of situations where users have to end a path
with a space
2017-05-16 09:17:19 -07:00
Gabriel Gonzalez
cd9c3f97e0 Update Prelude (#57)
This adds new builtins to the Prelude and also adds corresponding tests
2017-05-15 12:54:28 -07:00
Gabriel Gonzalez
d292d4bfb4 Add tests for Prelude examples (#56)
This adds tests that match the examples in the Prelude documentation and
also fixes a couple of mistakes caught along the way
2017-05-14 10:45:24 -07:00
Markus Hauck
05e7fff07f Implement Double/show and Integer/show (#54)
* Implement Integer/show

Relates to #49

* Implement Double/show

Relates to #49
2017-05-09 11:16:38 -07:00
Markus Hauck
6a6cc6e41a Implement Natural/show (#52)
* Implement Natural/show

* Rename exprFXX variables to reflect the meaning
2017-05-08 13:00:48 -07:00
Gabriel Gonzalez
40390626a4 Fix build . fold fusion tests (#51)
The previous tests for `build . fold` fusion for `Optional` values would
succeed even without fusion.  This change updates the tests to only
succeed if fusion is occurring.
2017-05-08 10:43:13 -07:00
Markus Hauck
a40cd7cb75 Implement Natural/toInteger (#50)
* Move test utils into separate module and use custom assertions

* Implement Natural/toInteger as primitive conversion

Relates to #49
2017-05-08 06:51:58 -07:00
Gabriel Gonzalez
dcff2c3bad Change tests to test source code (#48)
This change updates the test to test Dhall source code so that we're
exercising the system from end to end.  This also makes it easier to
author tests since expressions can be written as Dhall source code
instead of an abstract syntax tree.
2017-05-07 13:10:27 -07:00
Gabriel Gonzalez
6c5cacd7a2 Increase upper bound on vector (#46) 2017-05-07 08:34:39 -07:00