summaryrefslogtreecommitdiff
path: root/dhall/src/core
diff options
context:
space:
mode:
authorNadrieril2019-08-20 16:39:27 +0200
committerNadrieril2019-08-20 16:39:27 +0200
commit04438824db21fb5d9d3a2abdb3fa167875bda892 (patch)
treea146443659088dd7330e4456f7c01c2c701ef4bf /dhall/src/core
parent38a82c53ef45e802cf5816a8afcbf36a69c91174 (diff)
Add Value::from_builtin
Diffstat (limited to 'dhall/src/core')
-rw-r--r--dhall/src/core/value.rs7
-rw-r--r--dhall/src/core/valuef.rs10
2 files changed, 5 insertions, 12 deletions
diff --git a/dhall/src/core/value.rs b/dhall/src/core/value.rs
index 5367c86..f897f16 100644
--- a/dhall/src/core/value.rs
+++ b/dhall/src/core/value.rs
@@ -2,14 +2,14 @@ use std::borrow::Cow;
use std::cell::{Ref, RefCell, RefMut};
use std::rc::Rc;
-use dhall_syntax::Const;
+use dhall_syntax::{Builtin, Const};
use crate::core::context::TypecheckContext;
use crate::core::valuef::ValueF;
use crate::core::var::{AlphaVar, Shift, Subst};
use crate::error::{TypeError, TypeMessage};
use crate::phase::normalize::{apply_any, normalize_whnf, OutputSubExpr};
-use crate::phase::typecheck::const_to_value;
+use crate::phase::typecheck::{builtin_to_value, const_to_value};
use crate::phase::{NormalizedSubExpr, Typed};
#[derive(Debug, Clone, Copy)]
@@ -115,6 +115,9 @@ impl Value {
pub fn const_type() -> Self {
Value::from_const(Const::Type)
}
+ pub fn from_builtin(b: Builtin) -> Self {
+ builtin_to_value(b)
+ }
pub(crate) fn as_const(&self) -> Option<Const> {
match &*self.as_whnf() {
diff --git a/dhall/src/core/valuef.rs b/dhall/src/core/valuef.rs
index 0c3058d..da03cbd 100644
--- a/dhall/src/core/valuef.rs
+++ b/dhall/src/core/valuef.rs
@@ -257,16 +257,6 @@ impl ValueF {
}
}
- /// Apply to a valuef
- pub(crate) fn app(self, val: ValueF) -> ValueF {
- self.app_valuef(val)
- }
-
- /// Apply to a valuef
- pub(crate) fn app_valuef(self, val: ValueF) -> ValueF {
- self.app_value(val.into_value_untyped())
- }
-
/// Apply to a value
pub fn app_value(self, th: Value) -> ValueF {
Value::from_valuef_untyped(self).app_value(th)