summaryrefslogtreecommitdiff
path: root/dhall/src/semantics/builtins.rs
diff options
context:
space:
mode:
authorNadrieril2020-02-05 18:33:18 +0000
committerNadrieril2020-02-05 18:33:18 +0000
commit853807b68a8ec8928a4d497fc7ce2b3676036eed (patch)
treef4f9701a72d0989a0d1ae7c07acb7a95d789d905 /dhall/src/semantics/builtins.rs
parentde7664d9dda95dd16742bc30e16a967c43d687ee (diff)
Normalize toMap
Diffstat (limited to 'dhall/src/semantics/builtins.rs')
-rw-r--r--dhall/src/semantics/builtins.rs15
1 files changed, 5 insertions, 10 deletions
diff --git a/dhall/src/semantics/builtins.rs b/dhall/src/semantics/builtins.rs
index c20fb77..907d449 100644
--- a/dhall/src/semantics/builtins.rs
+++ b/dhall/src/semantics/builtins.rs
@@ -1,5 +1,5 @@
use crate::semantics::{
- self, typecheck, NzEnv, TyExpr, TyExprKind, Value, ValueKind, VarEnv,
+ typecheck, NzEnv, TyExpr, TyExprKind, Value, ValueKind, VarEnv,
};
use crate::syntax::map::DupTreeMap;
use crate::syntax::Const::Type;
@@ -301,9 +301,7 @@ fn apply_builtin(
_ => Ret::DoneAsIs,
},
(NaturalShow, [n]) => match &*n.kind() {
- NaturalLit(n) => Ret::ValueKind(TextLit(
- semantics::TextLit::from_text(n.to_string()),
- )),
+ NaturalLit(n) => Ret::Value(Value::from_text(n)),
_ => Ret::DoneAsIs,
},
(NaturalSubtract, [a, b]) => match (&*a.kind(), &*b.kind()) {
@@ -322,7 +320,7 @@ fn apply_builtin(
} else {
format!("+{}", n)
};
- Ret::ValueKind(TextLit(semantics::TextLit::from_text(s)))
+ Ret::Value(Value::from_text(s))
}
_ => Ret::DoneAsIs,
},
@@ -343,9 +341,7 @@ fn apply_builtin(
_ => Ret::DoneAsIs,
},
(DoubleShow, [n]) => match &*n.kind() {
- DoubleLit(n) => Ret::ValueKind(TextLit(
- semantics::TextLit::from_text(n.to_string()),
- )),
+ DoubleLit(n) => Ret::Value(Value::from_text(n)),
_ => Ret::DoneAsIs,
},
(TextShow, [v]) => match &*v.kind() {
@@ -355,8 +351,7 @@ fn apply_builtin(
let txt: InterpolatedText<Normalized> =
std::iter::once(InterpolatedTextContents::Text(s))
.collect();
- let s = txt.to_string();
- Ret::ValueKind(TextLit(semantics::TextLit::from_text(s)))
+ Ret::Value(Value::from_text(txt))
} else {
Ret::DoneAsIs
}