From 03da8fd6399f09c6282e0cd3930b6e39cc089043 Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Fri, 27 Dec 2019 21:14:45 +0000 Subject: Simplify Value::to_expr --- dhall/src/semantics/core/value.rs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'dhall/src/semantics/core') diff --git a/dhall/src/semantics/core/value.rs b/dhall/src/semantics/core/value.rs index 9b64bd2..f8146f5 100644 --- a/dhall/src/semantics/core/value.rs +++ b/dhall/src/semantics/core/value.rs @@ -306,14 +306,6 @@ impl ValueKind { Value::from_kind_and_type(self, t) } - /// Converts a value back to the corresponding AST expression. - pub(crate) fn to_expr( - &self, - opts: to_expr::ToExprOptions, - ) -> NormalizedExpr { - to_expr::kind_to_expr(self, opts) - } - pub(crate) fn normalize_mut(&mut self) { match self { ValueKind::Var(_) @@ -390,7 +382,6 @@ impl ValueKind { } impl ValueKind { - #[allow(dead_code)] pub(crate) fn map_ref_with_special_handling_of_binders<'a, V2>( &'a self, mut map_val: impl FnMut(&'a V) -> V2, @@ -407,6 +398,15 @@ impl ValueKind { .visit(self), ) } + + pub(crate) fn map_ref<'a, V2>( + &'a self, + map_val: impl Fn(&'a V) -> V2, + ) -> ValueKind { + self.map_ref_with_special_handling_of_binders(&map_val, |_, x| { + map_val(x) + }) + } } /// Compare two values for equality modulo alpha/beta-equivalence. -- cgit v1.2.3