summaryrefslogtreecommitdiff
path: root/dhall_core/src/printer.rs
diff options
context:
space:
mode:
authorNadrieril2019-04-17 01:22:28 +0200
committerNadrieril2019-04-17 01:22:28 +0200
commit63d3356f40ef48a7735a2151a14ad9952fc245db (patch)
treebaa79551653585fa3288f810bb6c2a0b906484cd /dhall_core/src/printer.rs
parent7389cbce9ab7c26ce23be24a5c3e57c9d86a716b (diff)
Normalize union constructors
Diffstat (limited to '')
-rw-r--r--dhall_core/src/printer.rs14
1 files changed, 12 insertions, 2 deletions
diff --git a/dhall_core/src/printer.rs b/dhall_core/src/printer.rs
index bb3c427..4d1ae2d 100644
--- a/dhall_core/src/printer.rs
+++ b/dhall_core/src/printer.rs
@@ -92,9 +92,9 @@ impl<SE: Display + Clone, N, E: Display> Display for ExprF<SE, Label, N, E> {
write!(f, "{} = {}", k, v)
})?,
UnionType(a) => fmt_list("< ", " | ", " >", a, f, |(k, v), f| {
- write!(f, "{} : ", k)?;
+ write!(f, "{}", k)?;
if let Some(v) = v {
- v.fmt(f)?
+ write!(f, ": {}", v)?;
}
Ok(())
})?,
@@ -108,6 +108,16 @@ impl<SE: Display + Clone, N, E: Display> Display for ExprF<SE, Label, N, E> {
}
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)?,
}