summaryrefslogtreecommitdiff
path: root/dhall/src/typecheck.rs
diff options
context:
space:
mode:
Diffstat (limited to 'dhall/src/typecheck.rs')
-rw-r--r--dhall/src/typecheck.rs21
1 files changed, 18 insertions, 3 deletions
diff --git a/dhall/src/typecheck.rs b/dhall/src/typecheck.rs
index 998d3ca..f51f1b6 100644
--- a/dhall/src/typecheck.rs
+++ b/dhall/src/typecheck.rs
@@ -42,7 +42,7 @@ impl Normalized {
&self.0
}
#[inline(always)]
- fn into_expr(self) -> SubExpr<X, X> {
+ pub(crate) fn into_expr(self) -> SubExpr<X, X> {
self.0
}
#[inline(always)]
@@ -50,7 +50,7 @@ impl Normalized {
&self.1
}
#[inline(always)]
- fn into_type(self) -> Type {
+ pub(crate) fn into_type(self) -> Type {
crate::expr::Type(TypeInternal::Expr(Box::new(self)))
}
// Expose the outermost constructor
@@ -78,7 +78,7 @@ impl Type {
}
}
#[inline(always)]
- fn into_normalized(self) -> Result<Normalized, TypeError<X>> {
+ pub(crate) fn into_normalized(self) -> Result<Normalized, TypeError<X>> {
use TypeInternal::*;
match self.0 {
Expr(e) => Ok(*e),
@@ -110,6 +110,21 @@ impl Type {
Untyped => Untyped,
})
}
+
+ #[inline(always)]
+ pub fn const_sort() -> Self {
+ Normalized(rc(ExprF::Const(Const::Sort)), UNTYPE).into_type()
+ }
+ #[inline(always)]
+ pub fn const_kind() -> Self {
+ Normalized(rc(ExprF::Const(Const::Kind)), Type::const_sort())
+ .into_type()
+ }
+ #[inline(always)]
+ pub fn const_type() -> Self {
+ Normalized(rc(ExprF::Const(Const::Type)), Type::const_kind())
+ .into_type()
+ }
}
const UNTYPE: Type = Type(TypeInternal::Untyped);