From 07a276c1d6ee892b93abbd7a73c78c96d56f4fe7 Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Mon, 19 Aug 2019 22:26:17 +0200 Subject: Reduce untyped construction of Values --- dhall/src/core/context.rs | 34 +++++++++--------------- dhall/src/core/value.rs | 68 +++++++++++++++++++---------------------------- dhall/src/core/valuef.rs | 14 +++++++--- 3 files changed, 51 insertions(+), 65 deletions(-) (limited to 'dhall/src/core') diff --git a/dhall/src/core/context.rs b/dhall/src/core/context.rs index 851e4c4..deabe44 100644 --- a/dhall/src/core/context.rs +++ b/dhall/src/core/context.rs @@ -3,7 +3,7 @@ use std::rc::Rc; use dhall_syntax::{Label, V}; -use crate::core::value::{TypedValue, Value}; +use crate::core::value::TypedValue; use crate::core::valuef::ValueF; use crate::core::var::{AlphaVar, Shift, Subst}; use crate::error::TypeError; @@ -11,7 +11,7 @@ use crate::error::TypeError; #[derive(Debug, Clone)] enum CtxItem { Kept(AlphaVar, TypedValue), - Replaced(Value, TypedValue), + Replaced(TypedValue), } #[derive(Debug, Clone)] @@ -32,10 +32,7 @@ impl TypecheckContext { e: TypedValue, ) -> Result { let mut vec = self.0.as_ref().clone(); - vec.push(( - x.clone(), - CtxItem::Replaced(e.to_value(), e.get_type()?.into_owned()), - )); + vec.push((x.clone(), CtxItem::Replaced(e))); Ok(TypecheckContext(Rc::new(vec))) } pub fn lookup(&self, var: &V