summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNadrieril2019-03-06 00:41:04 +0100
committerNadrieril2019-03-06 00:41:04 +0100
commit720a2f7050666e22cb028f82f3364ad2f7310131 (patch)
treee3693df1bbf7ab7c8e1b1facb61299ad54d42e42
parent6f16f07d90eb858799402b00749fc23514edfdcf (diff)
Add missing builtins
-rw-r--r--dhall/src/core.rs36
1 files changed, 27 insertions, 9 deletions
diff --git a/dhall/src/core.rs b/dhall/src/core.rs
index e22f8af..dfbe905 100644
--- a/dhall/src/core.rs
+++ b/dhall/src/core.rs
@@ -179,12 +179,16 @@ pub enum Builtin {
Text,
List,
Optional,
- NaturalFold,
NaturalBuild,
+ NaturalFold,
NaturalIsZero,
NaturalEven,
NaturalOdd,
+ NaturalToInteger,
NaturalShow,
+ IntegerToDouble,
+ IntegerShow,
+ DoubleShow,
ListBuild,
ListFold,
ListLength,
@@ -193,6 +197,8 @@ pub enum Builtin {
ListIndexed,
ListReverse,
OptionalFold,
+ OptionalBuild,
+ TextShow,
}
impl<'i> From<&'i str> for V<'i> {
@@ -438,19 +444,23 @@ impl Display for Builtin {
fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
use crate::Builtin::*;
f.write_str(match *self {
- Bool => "Bool",
- Natural => "Natural",
- Integer => "Integer",
- Double => "Double",
- Text => "Text",
- List => "List",
+ Bool => "Bool",
+ Natural => "Natural",
+ Integer => "Integer",
+ Double => "Double",
+ Text => "Text",
+ List => "List",
Optional => "Optional",
- NaturalFold => "Natural/fold",
NaturalBuild => "Natural/build",
+ NaturalFold => "Natural/fold",
NaturalIsZero => "Natural/isZero",
NaturalEven => "Natural/even",
NaturalOdd => "Natural/odd",
+ NaturalToInteger => "Natural/toInteger",
NaturalShow => "Natural/show",
+ IntegerToDouble => "Integer/toDouble",
+ IntegerShow => "Integer/show",
+ DoubleShow => "Double/show",
ListBuild => "List/build",
ListFold => "List/fold",
ListLength => "List/length",
@@ -459,6 +469,8 @@ impl Display for Builtin {
ListIndexed => "List/indexed",
ListReverse => "List/reverse",
OptionalFold => "Optional/fold",
+ OptionalBuild => "Optional/build",
+ TextShow => "Text/show",
})
}
}
@@ -474,12 +486,16 @@ impl Builtin {
"Text" => Some(Text),
"List" => Some(List),
"Optional" => Some(Optional),
- "Natural/fold" => Some(NaturalFold),
"Natural/build" => Some(NaturalBuild),
+ "Natural/fold" => Some(NaturalFold),
"Natural/isZero" => Some(NaturalIsZero),
"Natural/even" => Some(NaturalEven),
"Natural/odd" => Some(NaturalOdd),
+ "Natural/toInteger" => Some(NaturalToInteger),
"Natural/show" => Some(NaturalShow),
+ "Integer/toDouble" => Some(IntegerToDouble),
+ "Integer/show" => Some(IntegerShow),
+ "Double/show" => Some(DoubleShow),
"List/build" => Some(ListBuild),
"List/fold" => Some(ListFold),
"List/length" => Some(ListLength),
@@ -488,6 +504,8 @@ impl Builtin {
"List/indexed" => Some(ListIndexed),
"List/reverse" => Some(ListReverse),
"Optional/fold" => Some(OptionalFold),
+ "Optional/build" => Some(OptionalBuild),
+ "Text/show" => Some(TextShow),
_ => None,
}
}