From caf36246a517b884d7cfcf7c31e1b5d8fce60dfa Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Tue, 20 Aug 2019 13:49:13 +0200 Subject: Cleanup --- dhall/src/core/value.rs | 16 +++------------- dhall/src/core/valuef.rs | 6 +++--- 2 files changed, 6 insertions(+), 16 deletions(-) (limited to 'dhall/src/core') diff --git a/dhall/src/core/value.rs b/dhall/src/core/value.rs index 87816c4..0af7c8c 100644 --- a/dhall/src/core/value.rs +++ b/dhall/src/core/value.rs @@ -40,8 +40,7 @@ struct ValueInternal { /// Stores a possibly unevaluated value. Gets (partially) normalized on-demand, /// sharing computation automatically. Uses a RefCell to share computation. -/// Can optionally store a type from typechecking to preserve type information through -/// normalization. +/// Can optionally store a type from typechecking to preserve type information. #[derive(Clone)] pub struct Value(Rc>); @@ -160,10 +159,6 @@ impl Value { pub(crate) fn to_expr_alpha(&self) -> NormalizedSubExpr { self.as_whnf().normalize_to_expr_maybe_alpha(true) } - // TODO: deprecated - pub(crate) fn to_value(&self) -> Value { - self.clone() - } /// TODO: cloning a valuef can often be avoided pub(crate) fn to_whnf(&self) -> ValueF { self.as_whnf().clone() @@ -172,8 +167,7 @@ impl Value { Typed::from_value(self) } - /// Mutates the contents. If no one else shares this thunk, - /// mutates directly, thus avoiding a RefCell lock. + /// Mutates the contents. If no one else shares this, this avoids a RefCell lock. fn mutate_internal(&mut self, f: impl FnOnce(&mut ValueInternal)) { match Rc::get_mut(&mut self.0) { // Mutate directly if sole owner @@ -183,7 +177,7 @@ impl Value { } } /// Normalizes contents to normal form; faster than `normalize_nf` if - /// no one else shares this thunk. + /// no one else shares this. pub(crate) fn normalize_mut(&mut self) { self.mutate_internal(|vint| vint.normalize_nf()) } @@ -218,10 +212,6 @@ impl Value { self.as_nf().normalize_to_expr_maybe_alpha(alpha) } - pub(crate) fn app_valuef(&self, val: ValueF) -> ValueF { - self.app_value(val.into_value_untyped()) - } - pub(crate) fn app_value(&self, th: Value) -> ValueF { apply_any(self.clone(), th) } diff --git a/dhall/src/core/valuef.rs b/dhall/src/core/valuef.rs index 0d2655e..0c3058d 100644 --- a/dhall/src/core/valuef.rs +++ b/dhall/src/core/valuef.rs @@ -257,17 +257,17 @@ impl ValueF { } } - /// Apply to a value + /// Apply to a valuef pub(crate) fn app(self, val: ValueF) -> ValueF { self.app_valuef(val) } - /// Apply to a value + /// Apply to a valuef pub(crate) fn app_valuef(self, val: ValueF) -> ValueF { self.app_value(val.into_value_untyped()) } - /// Apply to a thunk + /// Apply to a value pub fn app_value(self, th: Value) -> ValueF { Value::from_valuef_untyped(self).app_value(th) } -- cgit v1.2.3