summaryrefslogtreecommitdiff
path: root/dhall/src/semantics/nze
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/nze
parent7b649b8647c60f1c02050805520f307edff0a94f (diff)
Simplify conversions to/from TyExpr
Diffstat (limited to 'dhall/src/semantics/nze')
-rw-r--r--dhall/src/semantics/nze/value.rs20
1 files changed, 3 insertions, 17 deletions
diff --git a/dhall/src/semantics/nze/value.rs b/dhall/src/semantics/nze/value.rs
index 2ae6852..0603fb5 100644
--- a/dhall/src/semantics/nze/value.rs
+++ b/dhall/src/semantics/nze/value.rs
@@ -1,12 +1,10 @@
use std::collections::HashMap;
use std::rc::Rc;
-use crate::error::TypeError;
use crate::semantics::nze::lazy;
use crate::semantics::{
- apply_any, normalize_hir_whnf, normalize_one_layer, squash_textlit,
- type_with, Binder, BuiltinClosure, Hir, HirKind, NzEnv, NzVar, TyEnv,
- TyExpr, VarEnv,
+ apply_any, normalize_hir_whnf, normalize_one_layer, squash_textlit, Binder,
+ BuiltinClosure, Hir, HirKind, NzEnv, NzVar, TyEnv, VarEnv,
};
use crate::syntax::{
BinOp, Builtin, Const, ExprKind, InterpolatedTextContents, Label, LitKind,
@@ -146,8 +144,7 @@ impl Value {
if opts.normalize {
self.normalize();
}
-
- self.to_tyexpr_noenv().to_expr(opts)
+ self.to_hir_noenv().to_expr(opts)
}
pub(crate) fn to_expr_tyenv(&self, tyenv: &TyEnv) -> NormalizedExpr {
self.to_hir(tyenv.as_varenv()).to_expr_tyenv(tyenv)
@@ -161,10 +158,6 @@ impl Value {
Value::from_kind(apply_any(self.clone(), v))
}
- pub(crate) fn get_type(&self, tyenv: &TyEnv) -> Result<Value, TypeError> {
- self.to_tyexpr_tyenv(tyenv).get_type()
- }
-
pub fn to_hir(&self, venv: VarEnv) -> Hir {
let map_uniontype = |kts: &HashMap<Label, Option<Value>>| {
ExprKind::UnionType(
@@ -270,13 +263,6 @@ impl Value {
pub fn to_hir_noenv(&self) -> Hir {
self.to_hir(VarEnv::new())
}
- pub fn to_tyexpr_tyenv(&self, tyenv: &TyEnv) -> TyExpr {
- let hir = self.to_hir(tyenv.as_varenv());
- type_with(tyenv, &hir).unwrap()
- }
- pub fn to_tyexpr_noenv(&self) -> TyExpr {
- self.to_tyexpr_tyenv(&TyEnv::new())
- }
}
impl ValueInternal {