summaryrefslogtreecommitdiff
path: root/dhall/src/semantics/nze
diff options
context:
space:
mode:
authorNadrieril2020-02-11 13:12:13 +0000
committerNadrieril2020-02-11 13:14:37 +0000
commit5a2538d174fd36a8ed7f4fa344b9583fc48bd977 (patch)
tree0f4ac9d8a7de51958ebdea742e28cb6147cd1502 /dhall/src/semantics/nze
parentc3ed75dc4b354becac0821e4288105dc2a300c4c (diff)
Remove the Embed variant from ExprKind
Diffstat (limited to 'dhall/src/semantics/nze')
-rw-r--r--dhall/src/semantics/nze/normalize.rs6
-rw-r--r--dhall/src/semantics/nze/value.rs16
2 files changed, 7 insertions, 15 deletions
diff --git a/dhall/src/semantics/nze/normalize.rs b/dhall/src/semantics/nze/normalize.rs
index d12146a..03b91a5 100644
--- a/dhall/src/semantics/nze/normalize.rs
+++ b/dhall/src/semantics/nze/normalize.rs
@@ -6,7 +6,6 @@ use crate::semantics::{
Binder, BuiltinClosure, Closure, Hir, HirKind, TextLit, Value, ValueKind,
};
use crate::syntax::{BinOp, Builtin, ExprKind, InterpolatedTextContents};
-use crate::Normalized;
pub(crate) fn apply_any(f: Value, a: Value) -> ValueKind {
match f.kind() {
@@ -90,7 +89,7 @@ enum Ret<'a> {
ValueKind(ValueKind),
Value(Value),
ValueRef(&'a Value),
- Expr(ExprKind<Value, Normalized>),
+ Expr(ExprKind<Value>),
}
fn apply_binop<'a>(o: BinOp, x: &'a Value, y: &'a Value) -> Option<Ret<'a>> {
@@ -215,7 +214,7 @@ fn apply_binop<'a>(o: BinOp, x: &'a Value, y: &'a Value) -> Option<Ret<'a>> {
}
pub(crate) fn normalize_one_layer(
- expr: ExprKind<Value, Normalized>,
+ expr: ExprKind<Value>,
env: &NzEnv,
) -> ValueKind {
use ValueKind::{
@@ -233,7 +232,6 @@ pub(crate) fn normalize_one_layer(
ExprKind::Lam(..)
| ExprKind::Pi(..)
| ExprKind::Let(..)
- | ExprKind::Embed(_)
| ExprKind::Var(_) => {
unreachable!("This case should have been handled in typecheck")
}
diff --git a/dhall/src/semantics/nze/value.rs b/dhall/src/semantics/nze/value.rs
index a60be9d..0df3c74 100644
--- a/dhall/src/semantics/nze/value.rs
+++ b/dhall/src/semantics/nze/value.rs
@@ -12,7 +12,7 @@ use crate::syntax::{
BinOp, Builtin, Const, ExprKind, Integer, InterpolatedTextContents, Label,
NaiveDouble, Natural, Span,
};
-use crate::{Normalized, NormalizedExpr, ToExprOptions};
+use crate::{NormalizedExpr, ToExprOptions};
/// Stores a possibly unevaluated value. Gets (partially) normalized on-demand, sharing computation
/// automatically. Uses a Rc<RefCell> to share computation.
@@ -34,10 +34,7 @@ pub(crate) enum Thunk {
/// A completely unnormalized expression.
Thunk { env: NzEnv, body: Hir },
/// A partially normalized expression that may need to go through `normalize_one_layer`.
- PartialExpr {
- env: NzEnv,
- expr: ExprKind<Value, Normalized>,
- },
+ PartialExpr { env: NzEnv, expr: ExprKind<Value> },
}
/// An unevaluated subexpression that takes an argument.
@@ -96,7 +93,7 @@ pub(crate) enum ValueKind {
TextLit(TextLit),
Equivalence(Value, Value),
/// Invariant: evaluation must not be able to progress with `normalize_one_layer`?
- PartialExpr(ExprKind<Value, Normalized>),
+ PartialExpr(ExprKind<Value>),
}
impl Value {
@@ -106,7 +103,7 @@ impl Value {
ValueInternal::from_thunk(Thunk::new(env, hir), span).into_value()
}
/// Construct a Value from a partially normalized expression that's not in WHNF.
- pub(crate) fn from_partial_expr(e: ExprKind<Value, Normalized>) -> Value {
+ pub(crate) fn from_partial_expr(e: ExprKind<Value>) -> Value {
// TODO: env
let env = NzEnv::new();
ValueInternal::from_thunk(
@@ -389,10 +386,7 @@ impl Thunk {
fn new(env: NzEnv, body: Hir) -> Self {
Thunk::Thunk { env, body }
}
- fn from_partial_expr(
- env: NzEnv,
- expr: ExprKind<Value, Normalized>,
- ) -> Self {
+ fn from_partial_expr(env: NzEnv, expr: ExprKind<Value>) -> Self {
Thunk::PartialExpr { env, expr }
}
fn eval(self) -> ValueKind {