From 33c1aa4bd1d5b83361eb52d00beb8d8c762225cd Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Thu, 9 May 2019 23:18:55 +0200 Subject: Make visibilities more consistent --- dhall/src/api/serde.rs | 2 +- dhall/src/core/context.rs | 34 +++++++++++------------ dhall/src/core/thunk.rs | 48 +++++++++++++++------------------ dhall/src/core/value.rs | 23 +++++++--------- dhall/src/core/var.rs | 16 +++++------ dhall/src/phase/mod.rs | 64 ++++++++++++++++++++++---------------------- dhall/src/phase/normalize.rs | 17 +++++------- dhall/src/phase/parse.rs | 6 ++--- dhall/src/phase/resolve.rs | 6 ++--- dhall/src/phase/typecheck.rs | 15 +++++------ 10 files changed, 106 insertions(+), 125 deletions(-) diff --git a/dhall/src/api/serde.rs b/dhall/src/api/serde.rs index 7be77c0..e1c8eef 100644 --- a/dhall/src/api/serde.rs +++ b/dhall/src/api/serde.rs @@ -1,6 +1,6 @@ use crate::api::de::{Deserialize, Value}; use crate::error::{Error, Result}; -use dhall_syntax::{SubExpr,ExprF, X}; +use dhall_syntax::{ExprF, SubExpr, X}; use std::borrow::Cow; impl<'a, T> Deserialize for T diff --git a/dhall/src/core/context.rs b/dhall/src/core/context.rs index 328bfdc..62affcf 100644 --- a/dhall/src/core/context.rs +++ b/dhall/src/core/context.rs @@ -10,25 +10,25 @@ use crate::error::TypeError; use crate::phase::{Type, Typed}; #[derive(Debug, Clone)] -pub(crate) enum CtxItem { +pub enum CtxItem { Kept(AlphaVar, T), Replaced(Thunk, T), } #[derive(Debug, Clone)] -pub(crate) struct Context(Rc)>>); +pub struct Context(Rc)>>); #[derive(Debug, Clone)] -pub(crate) struct NormalizationContext(Context<()>); +pub struct NormalizationContext(Context<()>); #[derive(Debug, Clone)] -pub(crate) struct TypecheckContext(Context); +pub struct TypecheckContext(Context); impl Context { - pub(crate) fn new() -> Self { + pub fn new() -> Self { Context(Rc::new(Vec::new())) } - pub(crate) fn insert_kept(&self, x: &Label, t: T) -> Self + pub fn insert_kept(&self, x: &Label, t: T) -> Self where T: Shift + Clone, { @@ -36,7 +36,7 @@ impl Context { vec.push((x.clone(), CtxItem::Kept(x.into(), t.under_binder(x)))); Context(Rc::new(vec)) } - pub(crate) fn insert_replaced(&self, x: &Label, th: Thunk, t: T) -> Self + pub fn insert_replaced(&self, x: &Label, th: Thunk, t: T) -> Self where T: Clone, { @@ -44,7 +44,7 @@ impl Context { vec.push((x.clone(), CtxItem::Replaced(th, t))); Context(Rc::new(vec)) } - pub(crate) fn lookup(&self, var: &V