From 845abbb0404ac15cefeca8b6ac32d9b3f93e5987 Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Thu, 21 Mar 2019 16:36:46 +0100 Subject: Represent Optional literals more faithfully --- dhall_core/src/core.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'dhall_core/src/core.rs') diff --git a/dhall_core/src/core.rs b/dhall_core/src/core.rs index 1d733aa..52fc0cf 100644 --- a/dhall_core/src/core.rs +++ b/dhall_core/src/core.rs @@ -195,9 +195,10 @@ pub enum Expr { EmptyListLit(SubExpr), /// [x, y, z] NEListLit(Vec>), - /// `OptionalLit t [e] ~ [e] : Optional t` - /// `OptionalLit t [] ~ [] : Optional t` - OptionalLit(Option>, Option>), + /// None t + EmptyOptionalLit(SubExpr), + /// Some e + NEOptionalLit(SubExpr), /// `Record [(k1, t1), (k2, t2)] ~ { k1 : t1, k2 : t1 }` RecordType(BTreeMap>), /// `RecordLit [(k1, v1), (k2, v2)] ~ { k1 = v1, k2 = v2 }` @@ -346,7 +347,8 @@ where BinOp(o, x, y) => BinOp(*o, map(x), map(y)), EmptyListLit(t) => EmptyListLit(map(t)), NEListLit(es) => NEListLit(vec(es)), - OptionalLit(t, es) => OptionalLit(opt(t), opt(es)), + EmptyOptionalLit(t) => EmptyOptionalLit(map(t)), + NEOptionalLit(e) => NEOptionalLit(map(e)), RecordType(kts) => RecordType(btmap(kts)), RecordLit(kvs) => RecordLit(btmap(kvs)), UnionType(kts) => UnionType(btmap(kts)), -- cgit v1.2.3