From 8cb3046e0920bf24d66c578b1a2b184c741b73fe Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Tue, 7 May 2019 18:23:07 +0200 Subject: Move AlphaVar and AlphaLabel into a new module --- dhall/src/core/context.rs | 3 +- dhall/src/core/mod.rs | 1 + dhall/src/core/thunk.rs | 3 +- dhall/src/core/value.rs | 105 +--------------------------------------------- dhall/src/core/var.rs | 103 +++++++++++++++++++++++++++++++++++++++++++++ dhall/src/phase/mod.rs | 3 +- 6 files changed, 112 insertions(+), 106 deletions(-) create mode 100644 dhall/src/core/var.rs (limited to 'dhall/src') diff --git a/dhall/src/core/context.rs b/dhall/src/core/context.rs index 9b5beed..0466058 100644 --- a/dhall/src/core/context.rs +++ b/dhall/src/core/context.rs @@ -5,7 +5,8 @@ use dhall_syntax::context::Context; use dhall_syntax::{Label, V}; use crate::core::thunk::Thunk; -use crate::core::value::{AlphaVar, Value}; +use crate::core::value::Value; +use crate::core::var::AlphaVar; use crate::phase::{Normalized, Type, Typed}; #[derive(Debug, Clone)] diff --git a/dhall/src/core/mod.rs b/dhall/src/core/mod.rs index 8f5c2ca..a202e72 100644 --- a/dhall/src/core/mod.rs +++ b/dhall/src/core/mod.rs @@ -1,3 +1,4 @@ pub(crate) mod context; pub(crate) mod thunk; pub(crate) mod value; +pub(crate) mod var; diff --git a/dhall/src/core/thunk.rs b/dhall/src/core/thunk.rs index 2b013bb..14ef710 100644 --- a/dhall/src/core/thunk.rs +++ b/dhall/src/core/thunk.rs @@ -3,7 +3,8 @@ use std::rc::Rc; use crate::core::context::NormalizationContext; use crate::core::context::TypecheckContext; -use crate::core::value::{AlphaVar, Value}; +use crate::core::value::Value; +use crate::core::var::AlphaVar; use crate::error::TypeError; use crate::phase::normalize::{ apply_any, normalize_whnf, InputSubExpr, OutputSubExpr, diff --git a/dhall/src/core/value.rs b/dhall/src/core/value.rs index 28fcb3e..4c71778 100644 --- a/dhall/src/core/value.rs +++ b/dhall/src/core/value.rs @@ -3,29 +3,16 @@ use std::collections::BTreeMap; use dhall_proc_macros as dhall; use dhall_syntax::{ rc, Builtin, Const, ExprF, Integer, InterpolatedTextContents, Label, - Natural, V, X, + Natural, X, }; use crate::core::thunk::{Thunk, TypeThunk}; +use crate::core::var::{AlphaLabel, AlphaVar}; use crate::phase::normalize::{ apply_builtin, normalize_one_layer, squash_textlit, OutputSubExpr, }; use crate::phase::Typed; -/// Stores a pair of variables: a normal one and if relevant one -/// that corresponds to the alpha-normalized version of the first one. -/// Equality is up to alpha-equivalence. -#[derive(Debug, Clone, Eq)] -pub(crate) struct AlphaVar { - normal: V