allow arbitrary number of dashes in type rules

closes #23
This commit is contained in:
Stephen Chang 2016-08-18 16:49:23 -04:00
parent 6d99f352db
commit ebecdb663c
2 changed files with 9 additions and 3 deletions

View File

@ -30,11 +30,11 @@
(define-typed-syntax λ #:datum-literals (:)
[(λ ([x:id : τ_in:type] ...) e)
[([x x- : τ_in.norm] ...) [e e- τ_out]]
--------
-------
[ [_ (λ- (x- ...) e-) ( τ_in.norm ... τ_out)]]]
[(λ (x:id ...) e) (~→ τ_in ... τ_out)
[([x x- : τ_in] ...) [e e- τ_out]]
--------
---------
[ [_ (λ- (x- ...) e-) _]]])
(define-typed-syntax #%app

View File

@ -58,7 +58,13 @@
(for-meta -1 (submod ".." typecheck+) (except-in macrotypes/typecheck #%module-begin))
(for-meta -2 (except-in macrotypes/typecheck #%module-begin)))
(define-syntax-class ---
[pattern (~datum --------)])
[pattern dashes
#:do [(define str-dashes (symbol->string (syntax->datum #'dashes)))]
#:fail-unless (for/and ([d (in-string str-dashes)])
(char=? #\- d))
"expected a separator consisting of dashes"
#:fail-unless (>= (string-length str-dashes) 3)
"expected a separator of three or more dashes"])
(define-syntax-class elipsis
[pattern (~literal ...)])