summaryrefslogtreecommitdiff
path: root/dhall/src/semantics/hir.rs
diff options
context:
space:
mode:
authorNadrieril2020-02-13 20:17:41 +0000
committerNadrieril2020-02-13 20:17:41 +0000
commitf29a40fb55b898b3a3cc51f198e8522eaecf0777 (patch)
treeba31bed1f166c8fc0f448b477548cceeb5e4f8ef /dhall/src/semantics/hir.rs
parent7b649b8647c60f1c02050805520f307edff0a94f (diff)
Simplify conversions to/from TyExpr
Diffstat (limited to '')
-rw-r--r--dhall/src/semantics/hir.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/dhall/src/semantics/hir.rs b/dhall/src/semantics/hir.rs
index 288031c..f91aa73 100644
--- a/dhall/src/semantics/hir.rs
+++ b/dhall/src/semantics/hir.rs
@@ -1,5 +1,6 @@
#![allow(dead_code)]
-use crate::semantics::{NameEnv, NzEnv, TyEnv, Value};
+use crate::error::TypeError;
+use crate::semantics::{type_with, NameEnv, NzEnv, TyEnv, TyExpr, Value};
use crate::syntax::{Expr, ExprKind, Span, V};
use crate::{NormalizedExpr, ToExprOptions};
@@ -69,6 +70,11 @@ impl Hir {
hir_to_expr(self, opts, &mut env)
}
+ /// Typecheck the Hir.
+ pub fn typecheck(&self, env: &TyEnv) -> Result<TyExpr, TypeError> {
+ type_with(env, self)
+ }
+
/// Eval the Hir. It will actually get evaluated only as needed on demand.
pub fn eval(&self, env: &NzEnv) -> Value {
Value::new_thunk(env.clone(), self.clone())