Commit Graph

17 Commits

Author SHA1 Message Date
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
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
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
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
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
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
Markus Hauck
32aa2a71e1 Implement Optional/build with fusion (#44)
- Defines a new primitive `OptionalFold`
- Implements normalization:
  - inlining of Optional/build if constants are used as args
  - fusion of fold/build and build/fold
2017-05-01 12:00:15 -07:00
Markus Hauck
ca40559cdc Add test suite (#42) 2017-04-29 14:41:53 -07:00