Commit Graph

38 Commits

Author SHA1 Message Date
Gabriel Gonzalez
505a786c6d Add support for customizing derived auto implementation. Fixes #22 (#24)
This adds a new `deriveAuto` utility that you can customize with
`InterpretOptions` in order to transform the expected field or constructor
labels that Dhall expects

The most common use of this is to support data types that prefix field names
with underscores for lens support
2017-02-23 09:35:52 -08:00
Gabriel Gonzalez
df892060aa Export InvalidType 2017-02-05 10:32:32 -08:00
Gabriel Gonzalez
782d118c97 Provide a better error message if extract fails 2017-02-05 10:31:03 -08:00
Gabriel Gonzalez
cc5d22f4a8 Fix documentation
We *can* auto-generate `Interpret` instances for sum types
2017-02-05 07:27:07 -08:00
Gabriel Gonzalez
6509a16070 Remove unnecessary list type annotations in documentation 2017-02-05 07:23:25 -08:00
Gabriel Gonzalez
17290171fe Make Dhall -Wall-clean 2017-01-29 14:10:28 -08:00
Gabriel Gonzalez
961278d71a Change derived Interpret for data types with 1 constructor
They no longer need to be wrapped inside a union with 1 alternative and are
decoded directly from a record
2016-12-05 07:33:09 -08:00
Gabriel Gonzalez
20831bc24d Remove unnecessary first argument to load 2016-12-04 15:29:07 -08:00
Gabriel Gonzalez
94d7e99408 Update documentation 2016-12-04 15:19:01 -08:00
Gabriel Gonzalez
6e927f62f1 Tidy up pretty-printing logic 2016-12-04 15:10:27 -08:00
Gabriel Gonzalez
88776fd570 Update documentation 2016-11-24 22:13:36 -08:00
Gabriel Gonzalez
e34ce03ea4 Update documentation 2016-11-24 19:15:29 -08:00
Gabriel Gonzalez
96fe0ededb Update documentation 2016-11-24 14:59:02 -08:00
Gabriel Gonzalez
44fe3f7d6b Update documentation 2016-11-20 21:19:35 -08:00
Gabriel Gonzalez
38c0cd4866 Add detailed 2016-11-20 16:25:55 -08:00
Gabriel Gonzalez
7fe24bc8c4 Rename Maybe to Optional
The primary reason for this change is to make it easier to describe these values
both in documentation and in informal communication between developers.

Before, you'd have to say things like:

* A value of type `Maybe` (incorrect)
* A `Maybe` value (sounds weird)
* A value of type `Maybe a` for some `a` (correct, but very verbose)

Now you can say an `Optional` value and the meaning is precise and clear

A secondary reason for this change is to keep the terminology close to the
intended use of the language for configuration files.  Describing fields as
`Optional` instead of `Maybe` makes a lot of sense for configurations.

The disadvantage is that some uses of `Optional` don't make sense.  For example,
consider the type of `List/head`:

    List/head : ∀(a : Type) → List a → Optional a

It seems weird to say that the result of `List/head` is `Optional`.  However,
many languages (such as Java/Scala/F#/Swift) already use this name or `Option` and
they get along just fine.
2016-11-12 08:31:13 -08:00
Gabriel Gonzalez
1ac704ad76 Add source annotation for values read into Haskell via input 2016-11-05 08:36:16 -07:00
Gabriel Gonzalez
e3850beed6 Use (stdin) and (input) in Trifecta error messages
... instead of `(interactive)`
2016-11-03 09:40:29 -07:00
Gabriel Gonzalez
9b7aa9dad3 Remove old parser implementation 2016-10-30 19:31:47 -07:00
Gabriel Gonzalez
13eddef662 Initial switch to new trifecta-based parser
Still several bugs to work out
2016-10-30 18:33:14 -07:00
Gabriel Gonzalez
2909f8871b Add Note constructor 2016-10-29 21:48:18 -07:00
Gabriel Gonzalez
323cbdf289 Move the X type to the Dhall.TypeCheck module
... since it's not used in the `Dhall.Core` module at all
2016-10-18 09:18:01 -07:00
Gabriel Gonzalez
51a86a1ec8 Move type-checking logic to separate Dhall.TypeCheck module
The error messages alone warranted separating this out into a separate module
2016-10-17 18:34:51 -07:00
Gabriel Gonzalez
79ed8f300e Add support for decoding sum types into Haskell 2016-10-15 17:35:51 -07:00
Gabriel Gonzalez
91a933ba9a Use Builder internally for representing Text
This is more efficient since the only thing we ever do is concatenate text,
which `Builder` is optimized for.
2016-10-11 09:18:52 -07:00
Gabriel Gonzalez
076678f1de Add support for decoding Maybes 2016-09-18 15:38:36 -07:00
Gabriel Gonzalez
d39cf8876e Re-export Text 2016-09-18 15:24:54 -07:00
Gabriel Gonzalez
0da0968147 Polish documentation 2016-09-16 20:23:12 -07:00
Gabriel Gonzalez
d0a4134e25 Reintroduce Unicode support 2016-09-16 20:16:46 -07:00
Gabriel Gonzalez
c5b781e03e Change list literal syntax
Move the type annotation outside the list

This is to prepare for an equivalent syntax for `Maybe` literals
2016-09-15 09:34:55 -07:00
Gabriel Gonzalez
6580a4cbf1 Change [ a ] to List a 2016-09-15 09:03:12 -07:00
Gabriel Gonzalez
a4c2b5bca7 Update documentation 2016-09-12 21:27:47 -07:00
Gabriel Gonzalez
5cc537824b Update documentation 2016-09-12 21:20:55 -07:00
Gabriel Gonzalez
d3998b09a2 Switch to happy for parsing and simplify the alex lexer 2016-09-11 20:38:37 -07:00
Gabriel Gonzalez
f6990dd1af Update tutorial 2016-09-11 10:55:34 -07:00
Gabriel Gonzalez
d03a900583 Update documentation 2016-09-09 19:02:13 -07:00
Gabriel Gonzalez
b313facaa2 Update documentation 2016-09-09 09:51:31 -07:00
Gabriel Gonzalez
3a2faaa4fb Add support for decoding into records using GHC generics
Also began the tutorial
2016-09-09 09:17:25 -07:00