From 720a2f7050666e22cb028f82f3364ad2f7310131 Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Wed, 6 Mar 2019 00:41:04 +0100 Subject: Add missing builtins --- dhall/src/core.rs | 36 +++++++++++++++++++++++++++--------- 1 file 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, } } -- cgit v1.2.3