Skip to content

Commit b148b80

Browse files
committed
Hack to allow extensions to the universe
Helps with #133
1 parent c3a36a2 commit b148b80

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

cur-lib/cur/curnel/coc.rkt

+11-5
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,14 @@
3434
(define-syntax ~Type*
3535
(pattern-expander
3636
(syntax-parser
37-
[:id #'(~Type _)]
38-
[(_ n) #'(~Type n)]))))
37+
[:id
38+
#'(~and b
39+
(~parse (~Type _)
40+
((current-type-eval) #'b)))]
41+
[(_ n)
42+
#'(~and b
43+
(~parse (~Type n)
44+
((current-type-eval) #'b)))]))))
3945

4046
(define-typed-syntax Type
4147
[:id ≫ --- [≻ (Type 0)]]
@@ -61,7 +67,7 @@
6167

6268
(define-typed-syntax Π
6369
; Check
64-
[(_ (x:id (~datum :) A) B) ⇐ (~Type n:nat) ≫
70+
[(_ (x:id (~datum :) A) B) ⇐ (~Type* n:nat) ≫
6571
[⊢ A ≫ A- ⇐ (Type n)]
6672
[[x ≫ x-- : A-] ⊢ B ≫ B- ⇐ (Type n)]
6773
; TODO: Oh look a pattern. Should be built into [x >> x-] form, or something.
@@ -85,8 +91,8 @@
8591

8692
[(_ (x:id (~datum :) A) B) ≫
8793
; NB: Expect a type of arbitrary level, for better errors
88-
[⊢ A ≫ A- ⇒ (~or (~Type n:nat) U₁)]
89-
[[x ≫ x-- : A-] ⊢ B ≫ B- ⇒ (~or (~Type m:nat) U₂)]
94+
[⊢ A ≫ A- ⇒ (~or (~Type* n:nat) U₁)]
95+
[[x ≫ x-- : A-] ⊢ B ≫ B- ⇒ (~or (~Type* m:nat) U₂)]
9096
#:fail-unless (attribute n)
9197
(type-error #:src #'A- #:msg "expected (Type n) (for some n), given ~a" #'U₁)
9298
#:fail-unless (attribute m)

0 commit comments

Comments
 (0)