-
Notifications
You must be signed in to change notification settings - Fork 210
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
... as standardized in dhall-lang/dhall-lang#227 The legacy `Optional` syntax is still supported for now but the normal form for `Optional` literals now prefers `Some`/`None`. The `dhall lint` command will automatically migrate the old `Optional` literal syntax to the new syntax.
- Loading branch information
1 parent
507b21a
commit a974532
Showing
96 changed files
with
829 additions
and
569 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,17 @@ | ||
{ and = | ||
./and | ||
./and | ||
, build = | ||
./build | ||
./build | ||
, even = | ||
./even | ||
./even | ||
, fold = | ||
./fold | ||
./fold | ||
, not = | ||
./not | ||
./not | ||
, odd = | ||
./odd | ||
./odd | ||
, or = | ||
./or | ||
./or | ||
, show = | ||
./show | ||
./show | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{ show = ./show } | ||
{ show = ./show } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{- | ||
Compose two functions into one. | ||
|
||
Examples: | ||
|
||
``` | ||
./compose Natural Natural Bool (λ(n : Natural) → n + n) ../Natural/even 3 | ||
= True | ||
``` | ||
-} | ||
let compose | ||
: ∀(a : Type) → ∀(b : Type) → ∀(c : Type) → (a → b) → (b → c) → a → c | ||
= λ(A : Type) | ||
→ λ(B : Type) | ||
→ λ(C : Type) | ||
→ λ(f : A → B) | ||
→ λ(g : B → C) | ||
→ λ(x : A) | ||
→ g (f x) | ||
|
||
in compose |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{ compose = ./compose } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{ show = ./show } | ||
{ show = ./show } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
{- | ||
This type is used as part of `dhall-json`'s support for preserving alternative | ||
names | ||
|
||
For example, this Dhall code: | ||
|
||
``` | ||
let Example = < Left : { foo : Natural } | Right : { bar : Bool } > | ||
|
||
in let example = constructors Example | ||
|
||
in let Nesting = < Inline : {} | Nested : Text > | ||
|
||
in let nesting = constructors Nesting | ||
|
||
in { field = "name" | ||
, nesting = nesting.Inline {=} | ||
, contents = example.Left { foo = 2 } | ||
} | ||
``` | ||
|
||
... generates this JSON: | ||
|
||
``` | ||
{ | ||
"foo": 2, | ||
"name": "Left" | ||
} | ||
``` | ||
|
||
-} | ||
let Nesting : Type = < Inline : {} | Nested : Text > in Nesting |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
{- | ||
This is a convenient type-level function when using `dhall-to-json`'s support | ||
for preserving alternative names | ||
|
||
For example, this code: | ||
|
||
``` | ||
let map = ../List/map | ||
|
||
in let Provisioner = | ||
< shell : | ||
{ inline : List Text } | ||
| file : | ||
{ source : Text, destination : Text } | ||
> | ||
|
||
in let provisioner = constructors Provisioner | ||
|
||
in let Tagged = ./Tagged | ||
|
||
in let nesting = constructors ./Nesting | ||
|
||
in let wrap | ||
: Provisioner → Tagged Provisioner | ||
= λ(x : Provisioner) | ||
→ { field = "type", nesting = nesting.Nested "params", contents = x } | ||
|
||
in { provisioners = | ||
map | ||
Provisioner | ||
(Tagged Provisioner) | ||
wrap | ||
[ provisioner.shell { inline = [ "echo foo" ] } | ||
, provisioner.file | ||
{ source = "app.tar.gz", destination = "/tmp/app.tar.gz" } | ||
] | ||
} | ||
``` | ||
|
||
... produces this JSON: | ||
|
||
``` | ||
{ | ||
"provisioners": [ | ||
{ | ||
"params": { | ||
"inline": [ | ||
"echo foo" | ||
] | ||
}, | ||
"type": "shell" | ||
}, | ||
{ | ||
"params": { | ||
"destination": "/tmp/app.tar.gz", | ||
"source": "app.tar.gz" | ||
}, | ||
"type": "file" | ||
} | ||
] | ||
} | ||
``` | ||
|
||
-} | ||
let Tagged | ||
: Type → Type | ||
= λ(a : Type) → { field : Text, nesting : ./Nesting, contents : a } | ||
|
||
in Tagged |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{- | ||
Builds a key-value record such that a List of them will be converted to a | ||
homogeneous record by dhall-to-json and dhall-to-yaml. | ||
Both key and value are fixed to Text. | ||
Take a look at `Record/keyValue` for a polymorphic version. | ||
|
||
Example: | ||
|
||
``` | ||
./keyText "foo" "bar" = { mapKey = "foo", mapValue = "bar" } | ||
``` | ||
-} | ||
|
||
let keyText = | ||
λ(key : Text) → λ(value : Text) → { mapKey = key, mapValue = value } | ||
|
||
in keyText |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{- | ||
Builds a key-value record such that a List of them will be converted to a | ||
homogeneous record by dhall-to-json and dhall-to-yaml. | ||
|
||
Examples: | ||
|
||
``` | ||
./keyValue Natural "foo" 2 = { mapKey = "foo", mapValue = 2 } | ||
|
||
./keyValue Text "bar" "baz" = { mapKey = "bar", mapValue = "baz" } | ||
``` | ||
-} | ||
|
||
let keyValue = | ||
λ(v : Type) | ||
→ λ(key : Text) | ||
→ λ(value : v) | ||
→ { mapKey = key, mapValue = value } | ||
|
||
in keyValue |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{ keyText = ./keyText, keyValue = ./keyValue } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,39 @@ | ||
{ all = | ||
./all | ||
./all | ||
, any = | ||
./any | ||
./any | ||
, build = | ||
./build | ||
./build | ||
, concat = | ||
./concat | ||
./concat | ||
, concatMap = | ||
./concatMap | ||
./concatMap | ||
, filter = | ||
./filter | ||
./filter | ||
, fold = | ||
./fold | ||
./fold | ||
, generate = | ||
./generate | ||
./generate | ||
, head = | ||
./head | ||
./head | ||
, indexed = | ||
./indexed | ||
./indexed | ||
, iterate = | ||
./iterate | ||
./iterate | ||
, last = | ||
./last | ||
./last | ||
, length = | ||
./length | ||
./length | ||
, map = | ||
./map | ||
./map | ||
, null = | ||
./null | ||
./null | ||
, replicate = | ||
./replicate | ||
./replicate | ||
, reverse = | ||
./reverse | ||
./reverse | ||
, shifted = | ||
./shifted | ||
./shifted | ||
, unzip = | ||
./unzip | ||
./unzip | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,21 @@ | ||
{ build = | ||
./build | ||
./build | ||
, enumerate = | ||
./enumerate | ||
./enumerate | ||
, even = | ||
./even | ||
./even | ||
, fold = | ||
./fold | ||
./fold | ||
, isZero = | ||
./isZero | ||
./isZero | ||
, odd = | ||
./odd | ||
./odd | ||
, product = | ||
./product | ||
./product | ||
, sum = | ||
./sum | ||
./sum | ||
, show = | ||
./show | ||
./show | ||
, toInteger = | ||
./toInteger | ||
./toInteger | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.