From a0ac45ccc6bd0168f05626fdf1886560006fcda1 Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Sat, 9 Mar 2019 15:36:39 +0100 Subject: Use new Label type everywhere --- dhall/src/normalize.rs | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) (limited to 'dhall/src/normalize.rs') diff --git a/dhall/src/normalize.rs b/dhall/src/normalize.rs index 16d670f..6344c52 100644 --- a/dhall/src/normalize.rs +++ b/dhall/src/normalize.rs @@ -12,9 +12,7 @@ use std::fmt; /// However, `normalize` will not fail if the expression is ill-typed and will /// leave ill-typed sub-expressions unevaluated. /// -pub fn normalize( - e: &Expr, -) -> Expr +pub fn normalize(e: &Expr) -> Expr where S: Clone + fmt::Debug, T: Clone + fmt::Debug, @@ -26,9 +24,9 @@ where match e { // Matches that don't normalize everything right away Let(f, _, r, b) => { - let r2 = shift::(1, &V(f.clone(), 0), r); - let b2 = subst::(&V(f.clone(), 0), &r2, b); - let b3 = shift::(-1, &V(f.clone(), 0), &b2); + let r2 = shift::<_, S, _>(1, &V(f.clone(), 0), r); + let b2 = subst::<_, S, _>(&V(f.clone(), 0), &r2, b); + let b3 = shift::<_, T, _>(-1, &V(f.clone(), 0), &b2); normalize(&b3) } BoolIf(b, t, f) => match normalize(b) { @@ -38,16 +36,16 @@ where }, Annot(x, _) => normalize(x), Note(_, e) => normalize(e), - App(f, a) => match normalize::(f) { + App(f, a) => match normalize::(f) { Lam(x, _A, b) => { // Beta reduce let vx0 = &V(x, 0); - let a2 = shift::(1, vx0, a); - let b2 = subst::(vx0, &a2, &b); - let b3 = shift::(-1, vx0, &b2); + let a2 = shift::(1, vx0, a); + let b2 = subst::(vx0, &a2, &b); + let b3 = shift::(-1, vx0, &b2); normalize(&b3) } - f2 => match (f2, normalize::(a)) { + f2 => match (f2, normalize::(a)) { // fold/build fusion for `List` (App(box Builtin(ListBuild), _), App(box App(box Builtin(ListFold), _), box e2)) | (App(box Builtin(ListFold), _), App(box App(box Builtin(ListBuild), _), box e2)) | -- cgit v1.2.3