diff options
author | Nadrieril | 2019-12-27 21:14:45 +0000 |
---|---|---|
committer | Nadrieril | 2020-01-17 10:06:00 +0000 |
commit | 03da8fd6399f09c6282e0cd3930b6e39cc089043 (patch) | |
tree | 4892633d7860f7ff754f17ac61d243f3e92b055a /dhall/src/semantics/core | |
parent | 4dc195c8d8a2ef03621fb73d15df2c66ad68be2c (diff) |
Simplify Value::to_expr
Diffstat (limited to '')
-rw-r--r-- | dhall/src/semantics/core/value.rs | 18 |
1 files changed, 9 insertions, 9 deletions
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> { 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<Value> { } impl<V> ValueKind<V> { - #[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<V> ValueKind<V> { .visit(self), ) } + + pub(crate) fn map_ref<'a, V2>( + &'a self, + map_val: impl Fn(&'a V) -> V2, + ) -> ValueKind<V2> { + self.map_ref_with_special_handling_of_binders(&map_val, |_, x| { + map_val(x) + }) + } } /// Compare two values for equality modulo alpha/beta-equivalence. |