diff options
author | Nadrieril | 2020-02-15 19:44:40 +0000 |
---|---|---|
committer | Nadrieril | 2020-02-15 19:59:52 +0000 |
commit | aa867b21f57f9bef2ec2b9d8450736f9111189ee (patch) | |
tree | eab9042a53ceed53abd7982a83fd4d76cd869572 /dhall/src/semantics/hir.rs | |
parent | 5057144ed99bc4e1a76a0840dd39fc1bd862665c (diff) |
Introduce proper Type struct
Diffstat (limited to 'dhall/src/semantics/hir.rs')
-rw-r--r-- | dhall/src/semantics/hir.rs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/dhall/src/semantics/hir.rs b/dhall/src/semantics/hir.rs index c8258ff..d0a8a96 100644 --- a/dhall/src/semantics/hir.rs +++ b/dhall/src/semantics/hir.rs @@ -1,6 +1,6 @@ #![allow(dead_code)] use crate::error::TypeError; -use crate::semantics::{type_with, NameEnv, NzEnv, TyEnv, TyExpr, Value}; +use crate::semantics::{type_with, NameEnv, NzEnv, TyEnv, TyExpr, Type, Value}; use crate::syntax::{Expr, ExprKind, Span, V}; use crate::{NormalizedExpr, ToExprOptions}; @@ -79,6 +79,10 @@ impl Hir { pub fn eval(&self, env: impl Into<NzEnv>) -> Value { Value::new_thunk(env.into(), self.clone()) } + /// Evaluate to a Type. + pub fn eval_to_type(&self, env: impl Into<NzEnv>) -> Type { + self.eval(env).into() + } /// Eval a closed Hir (i.e. without free variables). It will actually get evaluated only as /// needed on demand. pub fn eval_closed_expr(&self) -> Value { |