summaryrefslogtreecommitdiff
path: root/serde_dhall
diff options
context:
space:
mode:
authorNadrieril2020-04-07 12:22:27 +0100
committerGitHub2020-04-07 12:22:27 +0100
commit832c99a3b28e70512d580a51fc378473834b2891 (patch)
tree95b417cb3349bd1896f661a3fce67531c52d5b7b /serde_dhall
parentd35cb130d80d628807a4247ddf84a8d0230c87ab (diff)
parent214a3c998a3358849495b54a60d46f626b131f0a (diff)
Merge pull request #159 from Nadrieril/operations
Factor out operations
Diffstat (limited to 'serde_dhall')
-rw-r--r--serde_dhall/src/value.rs15
1 files changed, 9 insertions, 6 deletions
diff --git a/serde_dhall/src/value.rs b/serde_dhall/src/value.rs
index d6631da..03cfdba 100644
--- a/serde_dhall/src/value.rs
+++ b/serde_dhall/src/value.rs
@@ -1,7 +1,9 @@
use std::collections::{BTreeMap, HashMap};
+use dhall::builtins::Builtin;
+use dhall::operations::OpKind;
use dhall::semantics::{Hir, HirKind, Nir, NirKind};
-use dhall::syntax::{Builtin, Expr, ExprKind, NumKind, Span};
+use dhall::syntax::{Expr, ExprKind, NumKind, Span};
use crate::{Error, ErrorKind, FromDhall, Result, Sealed};
@@ -218,13 +220,14 @@ impl SimpleType {
SimpleType::Integer => ExprKind::Builtin(Builtin::Integer),
SimpleType::Double => ExprKind::Builtin(Builtin::Double),
SimpleType::Text => ExprKind::Builtin(Builtin::Text),
- SimpleType::Optional(t) => ExprKind::App(
+ SimpleType::Optional(t) => ExprKind::Op(OpKind::App(
hir(ExprKind::Builtin(Builtin::Optional)),
t.to_hir(),
- ),
- SimpleType::List(t) => {
- ExprKind::App(hir(ExprKind::Builtin(Builtin::List)), t.to_hir())
- }
+ )),
+ SimpleType::List(t) => ExprKind::Op(OpKind::App(
+ hir(ExprKind::Builtin(Builtin::List)),
+ t.to_hir(),
+ )),
SimpleType::Record(kts) => ExprKind::RecordType(
kts.iter()
.map(|(k, t)| (k.as_str().into(), t.to_hir()))