From 546fc00e893ba214b7731c95cfaf493644b50447 Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Thu, 18 Apr 2019 12:01:21 +0200 Subject: Consistent type variable naming --- dhall_core/src/core.rs | 67 +++++++++++++++++++++++++------------------------- 1 file changed, 34 insertions(+), 33 deletions(-) (limited to 'dhall_core/src') diff --git a/dhall_core/src/core.rs b/dhall_core/src/core.rs index 24b4401..a233d67 100644 --- a/dhall_core/src/core.rs +++ b/dhall_core/src/core.rs @@ -213,21 +213,21 @@ impl ExprF { } } -impl Expr { - pub fn map_shallow( +impl Expr { + pub fn map_shallow( &self, map_expr: F1, map_note: F2, map_embed: F3, map_label: F4, - ) -> Expr + ) -> Expr where - A: Clone, - T: Clone, - S: Clone, - F1: Fn(&Self) -> Expr, - F2: Fn(&S) -> T, - F3: Fn(&A) -> B, + E: Clone, + N2: Clone, + N: Clone, + F1: Fn(&Self) -> Expr, + F2: Fn(&N) -> N2, + F3: Fn(&E) -> E2, F4: Fn(&Label) -> Label, { self.map_ref( @@ -238,42 +238,43 @@ impl Expr { ) } - pub fn map_embed(&self, map_embed: &F) -> Expr + pub fn map_embed(&self, map_embed: &F) -> Expr where - A: Clone, - S: Clone, - F: Fn(&A) -> B, + E: Clone, + N: Clone, + F: Fn(&E) -> E2, { - let recurse = |e: &Expr| -> Expr { e.map_embed(map_embed) }; - self.map_shallow(recurse, S::clone, map_embed, Label::clone) + let recurse = + |e: &Expr| -> Expr { e.map_embed(map_embed) }; + self.map_shallow(recurse, N::clone, map_embed, Label::clone) } - pub fn traverse_embed( + pub fn traverse_embed( &self, map_embed: F, - ) -> Result, Err> + ) -> Result, Err> where - S: Clone, - B: Clone, - F: FnMut(&A) -> Result, + N: Clone, + E2: Clone, + F: FnMut(&E) -> Result, { self.visit(&mut visitor::TraverseEmbedVisitor(map_embed)) } pub fn map_label(&self, map_label: &F) -> Self where - A: Clone, - S: Clone, + E: Clone, + N: Clone, F: Fn(&Label) -> Label, { let recurse = |e: &Self| -> Self { e.map_label(map_label) }; - self.map_shallow(recurse, S::clone, A::clone, map_label) + self.map_shallow(recurse, N::clone, E::clone, map_label) } - pub fn roll(&self) -> SubExpr + pub fn roll(&self) -> SubExpr where - S: Clone, - A: Clone, + N: Clone, + E: Clone, { rc(ExprF::clone(self)) } @@ -574,11 +575,11 @@ fn shift_var(delta: isize, var: &V