diff options
author | Nadrieril | 2019-05-05 01:44:20 +0200 |
---|---|---|
committer | Nadrieril | 2019-05-05 01:44:20 +0200 |
commit | 699cc6e23a4fe867abfb63129923e548436f9dea (patch) | |
tree | cf54f0a76d2e3dcbeb20ba38093e8d4f1e92ec84 | |
parent | 186505f9da55097bd10dbe998975e725a53fa78a (diff) |
Preserve text WHNF on concatenation
Diffstat (limited to '')
-rw-r--r-- | dhall/src/normalize.rs | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/dhall/src/normalize.rs b/dhall/src/normalize.rs index dbae481..a0001da 100644 --- a/dhall/src/normalize.rs +++ b/dhall/src/normalize.rs @@ -5,8 +5,8 @@ use std::rc::Rc; use dhall_proc_macros as dhall; use dhall_syntax::context::Context; use dhall_syntax::{ - rc, BinOp, Builtin, Const, ExprF, Integer, - InterpolatedTextContents, Label, Natural, Span, SubExpr, V, X, + rc, BinOp, Builtin, Const, ExprF, Integer, InterpolatedTextContents, Label, + Natural, Span, SubExpr, V, X, }; use crate::expr::{Normalized, Type, Typed, TypedInternal}; @@ -1467,21 +1467,21 @@ fn normalize_one_layer(expr: ExprF<Thunk, Label, X>) -> Value { (TextAppend, TextLit(x), _) if x.is_empty() => RetThunkRef(y), (TextAppend, _, TextLit(y)) if y.is_empty() => RetThunkRef(x), (TextAppend, TextLit(x), TextLit(y)) => RetValue(TextLit( - x.iter().chain(y.iter()).cloned().collect(), + squash_textlit(x.iter().chain(y.iter()).cloned()), )), (TextAppend, TextLit(x), _) => { use std::iter::once; let y = InterpolatedTextContents::Expr(y.clone()); - RetValue(TextLit( - x.iter().cloned().chain(once(y)).collect(), - )) + RetValue(TextLit(squash_textlit( + x.iter().cloned().chain(once(y)), + ))) } (TextAppend, _, TextLit(y)) => { use std::iter::once; let x = InterpolatedTextContents::Expr(x.clone()); - RetValue(TextLit( - once(x).chain(y.iter().cloned()).collect(), - )) + RetValue(TextLit(squash_textlit( + once(x).chain(y.iter().cloned()), + ))) } _ => { |