summaryrefslogtreecommitdiff
path: root/dhall/src/typecheck.rs
diff options
context:
space:
mode:
authorNadrieril2019-04-06 22:37:39 +0200
committerNadrieril2019-04-06 22:41:11 +0200
commitf93aee4dcf71c85b826244b3b57949ffbdb820c4 (patch)
tree8f680d201a4c30963bc2edfc1205404128230505 /dhall/src/typecheck.rs
parentc4438eb3d52b1a69c9022b12e8de135b8c9991c9 (diff)
Add Sort type universe
Diffstat (limited to '')
-rw-r--r--dhall/src/typecheck.rs9
1 files changed, 6 insertions, 3 deletions
diff --git a/dhall/src/typecheck.rs b/dhall/src/typecheck.rs
index d62fe5a..5457701 100644
--- a/dhall/src/typecheck.rs
+++ b/dhall/src/typecheck.rs
@@ -36,16 +36,19 @@ fn axiom<S>(c: Const) -> Result<Const, TypeError<S>> {
use dhall_core::ExprF::*;
match c {
Type => Ok(Kind),
- Kind => Err(TypeError::new(&Context::new(), rc(Const(Kind)), Untyped)),
+ Kind => Ok(Sort),
+ Sort => Err(TypeError::new(&Context::new(), rc(Const(Sort)), Untyped)),
}
}
fn rule(a: Const, b: Const) -> Result<Const, ()> {
use dhall_core::Const::*;
match (a, b) {
- (Type, Kind) => Err(()),
+ (_, Type) => Ok(Type),
(Kind, Kind) => Ok(Kind),
- (Type, Type) | (Kind, Type) => Ok(Type),
+ (Sort, Sort) => Ok(Sort),
+ (Sort, Kind) => Ok(Sort),
+ _ => Err(()),
}
}