diff options
author | Nadrieril | 2019-08-16 17:56:19 +0200 |
---|---|---|
committer | Nadrieril | 2019-08-16 18:01:46 +0200 |
commit | 88ebc0f9d561a2541aad84a3152511a0439db8b4 (patch) | |
tree | 73571d5509f8631da63c09ec78acd30862f237f9 /dhall/src/phase/typecheck.rs | |
parent | e8bf879471708ac2cc03df904d14a618daaf2132 (diff) |
Reduce api surface of dhall crate
Helps detect unused code
Diffstat (limited to 'dhall/src/phase/typecheck.rs')
-rw-r--r-- | dhall/src/phase/typecheck.rs | 12 |
1 files changed, 6 insertions, 6 deletions
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<Type, TypeError> { +pub(crate) fn type_of_const(c: Const) -> Result<Type, TypeError> { 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<E>(b: Builtin) -> Expr<E> { /// 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<Normalized>, ) -> Result<Type, TypeError> { Ok(type_with(ctx, e)?.to_type()) } -pub fn builtin_to_type(b: Builtin) -> Result<Type, TypeError> { +pub(crate) fn builtin_to_type(b: Builtin) -> Result<Type, TypeError> { mktype(&TypecheckContext::new(), SubExpr::from_builtin(b)) } @@ -1009,15 +1009,15 @@ fn type_of(e: SubExpr<Normalized>) -> Result<Typed, TypeError> { Ok(e) } -pub fn typecheck(e: Resolved) -> Result<Typed, TypeError> { +pub(crate) fn typecheck(e: Resolved) -> Result<Typed, TypeError> { type_of(e.0) } -pub fn typecheck_with(e: Resolved, ty: &Type) -> Result<Typed, TypeError> { +pub(crate) fn typecheck_with(e: Resolved, ty: &Type) -> Result<Typed, TypeError> { 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)) } |