summaryrefslogtreecommitdiff
path: root/dhall/src/normalize.rs
diff options
context:
space:
mode:
authorNadrieril2019-04-30 14:45:25 +0200
committerNadrieril2019-04-30 14:45:25 +0200
commite2626a0bfd4b145e7d54c2150457f57e798ba2f7 (patch)
treede56af3215419814df3079c869c2bebd0c5383f5 /dhall/src/normalize.rs
parent65a242abfa4d881dc17f216b3eeeb8aedc663388 (diff)
Store a Thunk in Typed
Diffstat (limited to '')
-rw-r--r--dhall/src/normalize.rs24
1 files changed, 5 insertions, 19 deletions
diff --git a/dhall/src/normalize.rs b/dhall/src/normalize.rs
index f2ad8ea..5151790 100644
--- a/dhall/src/normalize.rs
+++ b/dhall/src/normalize.rs
@@ -28,23 +28,7 @@ impl<'a> Typed<'a> {
self.partially_normalize().normalize()
}
pub(crate) fn partially_normalize(self) -> PartiallyNormalized<'a> {
- PartiallyNormalized(
- normalize_whnf(
- NormalizationContext::from_typecheck_ctx(&self.2),
- self.0,
- ),
- self.1,
- self.3,
- )
- }
- /// Pretends this expression is normalized. Use with care.
- #[allow(dead_code)]
- pub fn skip_normalize(self) -> Normalized<'a> {
- Normalized(
- self.0.unroll().squash_embed(|e| e.0.clone()),
- self.1,
- self.3,
- )
+ PartiallyNormalized(self.0.as_whnf(), self.1, self.2)
}
}
@@ -300,7 +284,7 @@ impl EnvItem {
pub(crate) struct NormalizationContext(Rc<Context<Label, EnvItem>>);
impl NormalizationContext {
- fn new() -> Self {
+ pub(crate) fn new() -> Self {
NormalizationContext(Rc::new(Context::new()))
}
fn insert(&self, x: &Label, e: Thunk) -> Self {
@@ -323,7 +307,9 @@ impl NormalizationContext {
None => Value::Var(var.clone()),
}
}
- fn from_typecheck_ctx(tc_ctx: &crate::typecheck::TypecheckContext) -> Self {
+ pub(crate) fn from_typecheck_ctx(
+ tc_ctx: &crate::typecheck::TypecheckContext,
+ ) -> Self {
use crate::typecheck::EnvItem::*;
let mut ctx = Context::new();
for (k, vs) in tc_ctx.0.iter_keys() {