From 4bed7b11e227a3151a2ff9e74f9662c126aad5a4 Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Fri, 19 Apr 2019 14:42:36 +0200 Subject: Make App() only store one argument --- dhall_core/src/printer.rs | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) (limited to 'dhall_core/src/printer.rs') diff --git a/dhall_core/src/printer.rs b/dhall_core/src/printer.rs index 4d1ae2d..85105d9 100644 --- a/dhall_core/src/printer.rs +++ b/dhall_core/src/printer.rs @@ -56,12 +56,8 @@ impl Display for ExprF { ExprF::BinOp(op, a, b) => { write!(f, "{} {} {}", a, op, b)?; } - ExprF::App(a, args) => { - a.fmt(f)?; - for x in args { - f.write_str(" ")?; - x.fmt(f)?; - } + ExprF::App(a, b) => { + write!(f, "{} {}", a, b)?; } Field(a, b) => { write!(f, "{}.{}", a, b)?; @@ -216,10 +212,7 @@ impl Expr { OldOptionalLit(x, t) => OldOptionalLit(x, t.phase(Import)), EmptyOptionalLit(t) => EmptyOptionalLit(t.phase(Import)), NEOptionalLit(e) => NEOptionalLit(e.phase(Import)), - ExprF::App(a, args) => ExprF::App( - a.phase(Import), - args.into_iter().map(|x| x.phase(Import)).collect(), - ), + ExprF::App(f, a) => ExprF::App(f.phase(Import), a.phase(Import)), Field(a, b) => Field(a.phase(Primitive), b), Projection(e, ls) => Projection(e.phase(Primitive), ls), Note(n, b) => Note(n, b.phase(phase)), -- cgit v1.2.3 From ab93af7bb8bbe7785d76a86af531bae9b13574c4 Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Fri, 19 Apr 2019 21:28:18 +0200 Subject: A union constructor is a purely semantic value --- dhall_core/src/printer.rs | 10 ---------- 1 file changed, 10 deletions(-) (limited to 'dhall_core/src/printer.rs') diff --git a/dhall_core/src/printer.rs b/dhall_core/src/printer.rs index 85105d9..ea291a9 100644 --- a/dhall_core/src/printer.rs +++ b/dhall_core/src/printer.rs @@ -104,16 +104,6 @@ impl Display for ExprF { } f.write_str(" >")? } - UnionConstructor(x, map) => { - fmt_list("< ", " | ", " >", map, f, |(k, v), f| { - write!(f, "{}", k)?; - if let Some(v) = v { - write!(f, ": {}", v)?; - } - Ok(()) - })?; - write!(f, ".{}", x)? - } Embed(a) => a.fmt(f)?, Note(_, b) => b.fmt(f)?, } -- cgit v1.2.3 From 83bc67d4572fe7961842f915d5559ee489e13dfd Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Sat, 20 Apr 2019 23:12:25 +0200 Subject: An empty optional value is purely semantic --- dhall_core/src/printer.rs | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'dhall_core/src/printer.rs') diff --git a/dhall_core/src/printer.rs b/dhall_core/src/printer.rs index ea291a9..c4bad71 100644 --- a/dhall_core/src/printer.rs +++ b/dhall_core/src/printer.rs @@ -38,10 +38,7 @@ impl Display for ExprF { OldOptionalLit(Some(x), t) => { write!(f, "[{}] : Optional {}", x, t)?; } - EmptyOptionalLit(t) => { - write!(f, "None {}", t)?; - } - NEOptionalLit(e) => { + SomeLit(e) => { write!(f, "Some {}", e)?; } Merge(a, b, c) => { @@ -159,8 +156,7 @@ impl Expr { | EmptyListLit(_) | NEListLit(_) | OldOptionalLit(_, _) - | EmptyOptionalLit(_) - | NEOptionalLit(_) + | SomeLit(_) | Merge(_, _, _) | Annot(_, _) if phase > Base => @@ -200,8 +196,7 @@ impl Expr { ), EmptyListLit(t) => EmptyListLit(t.phase(Import)), OldOptionalLit(x, t) => OldOptionalLit(x, t.phase(Import)), - EmptyOptionalLit(t) => EmptyOptionalLit(t.phase(Import)), - NEOptionalLit(e) => NEOptionalLit(e.phase(Import)), + SomeLit(e) => SomeLit(e.phase(Import)), ExprF::App(f, a) => ExprF::App(f.phase(Import), a.phase(Import)), Field(a, b) => Field(a.phase(Primitive), b), Projection(e, ls) => Projection(e.phase(Primitive), ls), -- cgit v1.2.3