diff options
author | Nadrieril | 2019-03-21 16:36:46 +0100 |
---|---|---|
committer | Nadrieril | 2019-03-21 16:36:46 +0100 |
commit | 845abbb0404ac15cefeca8b6ac32d9b3f93e5987 (patch) | |
tree | 74a363bafddc951ae08fc722ab8d2f1891e57f28 /dhall_core/src/core.rs | |
parent | 427c5e55a6e6768b22c3e7ad40594d451ac024e7 (diff) |
Represent Optional literals more faithfully
Diffstat (limited to '')
-rw-r--r-- | dhall_core/src/core.rs | 10 |
1 files changed, 6 insertions, 4 deletions
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<Note, Embed> { EmptyListLit(SubExpr<Note, Embed>), /// [x, y, z] NEListLit(Vec<SubExpr<Note, Embed>>), - /// `OptionalLit t [e] ~ [e] : Optional t` - /// `OptionalLit t [] ~ [] : Optional t` - OptionalLit(Option<SubExpr<Note, Embed>>, Option<SubExpr<Note, Embed>>), + /// None t + EmptyOptionalLit(SubExpr<Note, Embed>), + /// Some e + NEOptionalLit(SubExpr<Note, Embed>), /// `Record [(k1, t1), (k2, t2)] ~ { k1 : t1, k2 : t1 }` RecordType(BTreeMap<Label, SubExpr<Note, Embed>>), /// `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)), |