diff options
author | Nadrieril | 2019-04-10 19:16:11 +0200 |
---|---|---|
committer | Nadrieril | 2019-04-10 19:16:11 +0200 |
commit | e1a30c6f248c0c17c97598290a0d94993dbb0325 (patch) | |
tree | 960eb4029f2ba9a824e34219915e942b1b65e4cd /dhall/src/typecheck.rs | |
parent | 982f86c34f69bb78b45a4b8b37a5bf5731f881eb (diff) |
Add SimpleType and SimpeStaticType. Derive the latter
Diffstat (limited to '')
-rw-r--r-- | dhall/src/typecheck.rs | 21 |
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); |