From cb86493012b268ec32ad85a42b54fb1a2adab7b0 Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Thu, 30 Jan 2020 14:20:01 +0000 Subject: s/as_whnf/kind/ --- dhall/src/semantics/core/value.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'dhall/src/semantics/core/value.rs') diff --git a/dhall/src/semantics/core/value.rs b/dhall/src/semantics/core/value.rs index e69d220..02c8013 100644 --- a/dhall/src/semantics/core/value.rs +++ b/dhall/src/semantics/core/value.rs @@ -157,7 +157,7 @@ impl Value { } pub(crate) fn as_const(&self) -> Option { - match &*self.as_whnf() { + match &*self.kind() { ValueKind::Const(c) => Some(*c), _ => None, } @@ -180,7 +180,7 @@ impl Value { /// This is what you want if you want to pattern-match on the value. /// WARNING: drop this ref before normalizing the same value or you will run into BorrowMut /// panics. - pub(crate) fn as_whnf(&self) -> Ref> { + pub(crate) fn kind(&self) -> Ref> { self.normalize_whnf(); self.as_kind() } @@ -194,7 +194,7 @@ impl Value { self.to_tyexpr_noenv().to_expr(opts) } pub(crate) fn to_whnf_ignore_type(&self) -> ValueKind { - self.as_whnf().clone() + self.kind().clone() } /// Before discarding type information, check that it matches the expected return type. pub(crate) fn to_whnf_check_type(&self, ty: &Value) -> ValueKind { @@ -233,7 +233,7 @@ impl Value { } pub(crate) fn app(&self, v: Value) -> Value { - let body_t = match &*self.get_type_not_sort().as_whnf() { + let body_t = match &*self.get_type_not_sort().kind() { ValueKind::PiClosure { annot, closure, .. } => { v.check_type(annot); closure.apply(v.clone()) @@ -617,7 +617,7 @@ impl Closure { // TODO: use Rc comparison to shortcut on identical pointers impl std::cmp::PartialEq for Value { fn eq(&self, other: &Self) -> bool { - *self.as_whnf() == *other.as_whnf() + *self.kind() == *other.kind() } } impl std::cmp::Eq for Value {} -- cgit v1.2.3