diff options
author | Nadrieril | 2020-04-07 12:22:27 +0100 |
---|---|---|
committer | GitHub | 2020-04-07 12:22:27 +0100 |
commit | 832c99a3b28e70512d580a51fc378473834b2891 (patch) | |
tree | 95b417cb3349bd1896f661a3fce67531c52d5b7b /serde_dhall/src | |
parent | d35cb130d80d628807a4247ddf84a8d0230c87ab (diff) | |
parent | 214a3c998a3358849495b54a60d46f626b131f0a (diff) |
Merge pull request #159 from Nadrieril/operations
Factor out operations
Diffstat (limited to '')
-rw-r--r-- | serde_dhall/src/value.rs | 15 |
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())) |