From 88ebc0f9d561a2541aad84a3152511a0439db8b4 Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Fri, 16 Aug 2019 17:56:19 +0200 Subject: Reduce api surface of dhall crate Helps detect unused code --- dhall/src/phase/typecheck.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'dhall/src/phase/typecheck.rs') diff --git a/dhall/src/phase/typecheck.rs b/dhall/src/phase/typecheck.rs index 5eab8da..56fb5ed 100644 --- a/dhall/src/phase/typecheck.rs +++ b/dhall/src/phase/typecheck.rs @@ -147,7 +147,7 @@ fn function_check(a: Const, b: Const) -> Const { } } -pub fn type_of_const(c: Const) -> Result { +pub(crate) fn type_of_const(c: Const) -> Result { match c { Const::Type => Ok(Type::from_const(Const::Kind)), Const::Kind => Ok(Type::from_const(Const::Sort)), @@ -300,14 +300,14 @@ fn type_of_builtin(b: Builtin) -> Expr { /// Takes an expression that is meant to contain a Type /// and turn it into a type, typechecking it along the way. -pub fn mktype( +pub(crate) fn mktype( ctx: &TypecheckContext, e: SubExpr, ) -> Result { Ok(type_with(ctx, e)?.to_type()) } -pub fn builtin_to_type(b: Builtin) -> Result { +pub(crate) fn builtin_to_type(b: Builtin) -> Result { mktype(&TypecheckContext::new(), SubExpr::from_builtin(b)) } @@ -1009,15 +1009,15 @@ fn type_of(e: SubExpr) -> Result { Ok(e) } -pub fn typecheck(e: Resolved) -> Result { +pub(crate) fn typecheck(e: Resolved) -> Result { type_of(e.0) } -pub fn typecheck_with(e: Resolved, ty: &Type) -> Result { +pub(crate) fn typecheck_with(e: Resolved, ty: &Type) -> Result { let expr: SubExpr<_> = e.0; let ty: SubExpr<_> = ty.to_expr(); type_of(expr.rewrap(ExprF::Annot(expr.clone(), ty))) } -pub fn skip_typecheck(e: Resolved) -> Typed { +pub(crate) fn skip_typecheck(e: Resolved) -> Typed { Typed::from_thunk_untyped(Thunk::new(NormalizationContext::new(), e.0)) } -- cgit v1.2.3