summaryrefslogtreecommitdiff
path: root/dhall/src/core
diff options
context:
space:
mode:
authorNadrieril2019-08-20 13:49:13 +0200
committerNadrieril2019-08-20 13:49:13 +0200
commitcaf36246a517b884d7cfcf7c31e1b5d8fce60dfa (patch)
tree13bab9e1145a8769b6dd4ca1d76d34af1ff6c12b /dhall/src/core
parent7dd22d6f55e3885835c7fe58b876f26937d0e7a4 (diff)
Cleanup
Diffstat (limited to 'dhall/src/core')
-rw-r--r--dhall/src/core/value.rs16
-rw-r--r--dhall/src/core/valuef.rs6
2 files changed, 6 insertions, 16 deletions
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<RefCell<ValueInternal>>);
@@ -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)
}