From 08e1d8ece4314b56d64fa08595c2e043b97896d1 Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Mon, 6 Apr 2020 17:19:31 +0100 Subject: Split off operations from main expr enum --- serde_dhall/src/value.rs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'serde_dhall/src') diff --git a/serde_dhall/src/value.rs b/serde_dhall/src/value.rs index d6631da..587349c 100644 --- a/serde_dhall/src/value.rs +++ b/serde_dhall/src/value.rs @@ -1,7 +1,7 @@ use std::collections::{BTreeMap, HashMap}; use dhall::semantics::{Hir, HirKind, Nir, NirKind}; -use dhall::syntax::{Builtin, Expr, ExprKind, NumKind, Span}; +use dhall::syntax::{Builtin, Expr, ExprKind, NumKind, OpKind, Span}; use crate::{Error, ErrorKind, FromDhall, Result, Sealed}; @@ -218,13 +218,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())) -- cgit v1.2.3