Typecheck prompt tags
This commit is contained in:
parent
e123e85a90
commit
4b5d6e71fd
|
@ -38,6 +38,7 @@
|
||||||
make-CustodianBox
|
make-CustodianBox
|
||||||
make-HeterogeneousVector
|
make-HeterogeneousVector
|
||||||
make-Continuation-Mark-Key
|
make-Continuation-Mark-Key
|
||||||
|
make-Prompt-Tag
|
||||||
make-ListDots))
|
make-ListDots))
|
||||||
|
|
||||||
;Section 9.2
|
;Section 9.2
|
||||||
|
@ -593,6 +594,7 @@
|
||||||
(make-ListDots a 'a)
|
(make-ListDots a 'a)
|
||||||
(-values (list (-pair b (-val '())) -Nat -Nat -Nat)))))]
|
(-values (list (-pair b (-val '())) -Nat -Nat -Nat)))))]
|
||||||
|
|
||||||
|
|
||||||
[call/cc (-poly (a b) (((a . -> . (Un)) . -> . b) . -> . (Un a b)))]
|
[call/cc (-poly (a b) (((a . -> . (Un)) . -> . b) . -> . (Un a b)))]
|
||||||
[call/ec (-poly (a b) (((a . -> . (Un)) . -> . b) . -> . (Un a b)))]
|
[call/ec (-poly (a b) (((a . -> . (Un)) . -> . b) . -> . (Un a b)))]
|
||||||
[call-with-current-continuation (-poly (a b) (((a . -> . (Un)) . -> . b) . -> . (Un a b)))]
|
[call-with-current-continuation (-poly (a b) (((a . -> . (Un)) . -> . b) . -> . (Un a b)))]
|
||||||
|
@ -2023,9 +2025,22 @@
|
||||||
[call-with-continuation-barrier (-poly (a) (-> (-> a) a))]
|
[call-with-continuation-barrier (-poly (a) (-> (-> a) a))]
|
||||||
[continuation-prompt-available? (-> -Prompt-Tag B)]
|
[continuation-prompt-available? (-> -Prompt-Tag B)]
|
||||||
|
|
||||||
[make-continuation-prompt-tag (->opt [Sym] -Prompt-Tag)]
|
[call-with-continuation-prompt
|
||||||
[default-continuation-prompt-tag (-> -Prompt-Tag)]
|
(-polydots (a b d c)
|
||||||
[continuation-prompt-tag? (make-pred-ty -Prompt-Tag)]
|
(cl->*
|
||||||
|
(-> (-> b) (make-Prompt-Tag b (->... '() (c c) d)) (->... '() (c c) d)
|
||||||
|
(Un b d))
|
||||||
|
(-> (-> b) Univ)))]
|
||||||
|
[abort-current-continuation
|
||||||
|
(-polydots (a b d e c)
|
||||||
|
(->... (list (make-Prompt-Tag b (->... '() (c c) d))) (c c) e))]
|
||||||
|
[call-with-composable-continuation
|
||||||
|
(-polydots (b c a)
|
||||||
|
(cl->*
|
||||||
|
(-> (->... '() (a a) b) (make-Prompt-Tag b c) (make-ValuesDots '() a 'a))))]
|
||||||
|
[make-continuation-prompt-tag (-poly (a b) (->opt [Sym] (make-Prompt-Tag a b)))]
|
||||||
|
[default-continuation-prompt-tag (-> (make-Prompt-Tag Univ (-> ManyUniv Univ)))]
|
||||||
|
;[continuation-prompt-tag? (make-pred-ty -Prompt-Tag)]
|
||||||
[dynamic-wind (-poly (a) (-> (-> ManyUniv) (-> a) (-> ManyUniv) a))]
|
[dynamic-wind (-poly (a) (-> (-> ManyUniv) (-> a) (-> ManyUniv) a))]
|
||||||
|
|
||||||
;Section 9.5 (Continuation Marks)
|
;Section 9.5 (Continuation Marks)
|
||||||
|
|
|
@ -143,7 +143,6 @@
|
||||||
[Place-Channel -Place-Channel]
|
[Place-Channel -Place-Channel]
|
||||||
[Place -Place]
|
[Place -Place]
|
||||||
[Will-Executor -Will-Executor]
|
[Will-Executor -Will-Executor]
|
||||||
[Prompt-Tag -Prompt-Tag]
|
|
||||||
|
|
||||||
|
|
||||||
[Listof -Listof]
|
[Listof -Listof]
|
||||||
|
@ -171,3 +170,4 @@
|
||||||
[Custodian-Boxof (-poly (a) (make-CustodianBox a))]
|
[Custodian-Boxof (-poly (a) (make-CustodianBox a))]
|
||||||
|
|
||||||
[Continuation-Mark-Key (-poly (a) (make-Continuation-Mark-Key a))]
|
[Continuation-Mark-Key (-poly (a) (make-Continuation-Mark-Key a))]
|
||||||
|
[Prompt-Tag (-poly (a b) (make-Prompt-Tag a b))]
|
|
@ -342,6 +342,10 @@
|
||||||
[(Continuation-Mark-Key: t)
|
[(Continuation-Mark-Key: t)
|
||||||
(set-chaperone!)
|
(set-chaperone!)
|
||||||
#`(continuation-mark-key/c #,(t->c t))]
|
#`(continuation-mark-key/c #,(t->c t))]
|
||||||
|
;; TODO: this is not quite right for case->
|
||||||
|
[(Prompt-Tag: s (Function: (list (arr: (list ts ...) _ _ _ _))))
|
||||||
|
(set-chaperone!)
|
||||||
|
#`(prompt-tag/c #,@(map t->c ts) #:call/cc #,(t->c s))]
|
||||||
;; TODO
|
;; TODO
|
||||||
[(F: v) (cond [(assoc v (vars)) => second]
|
[(F: v) (cond [(assoc v (vars)) => second]
|
||||||
[else (int-err "unknown var: ~a" v)])]
|
[else (int-err "unknown var: ~a" v)])]
|
||||||
|
|
|
@ -415,9 +415,9 @@
|
||||||
;; prompts with this tag will return a union of `body`
|
;; prompts with this tag will return a union of `body`
|
||||||
;; and the codomains of `handler`
|
;; and the codomains of `handler`
|
||||||
(def-type Prompt-Tag ([body Type/c] [handler Function?])
|
(def-type Prompt-Tag ([body Type/c] [handler Function?])
|
||||||
[#:key 'prompt-tag]
|
[#:frees (λ (f) (combine-frees (list (make-invariant (f body))
|
||||||
[#:frees (λ (f) (combine-frees (make-invariant (f body))
|
(make-invariant (f handler)))))]
|
||||||
(make-invariant (f handler))))])
|
[#:key 'prompt-tag])
|
||||||
|
|
||||||
;; value: the type of allowable values
|
;; value: the type of allowable values
|
||||||
(def-type Continuation-Mark-Key ([value Type/c])
|
(def-type Continuation-Mark-Key ([value Type/c])
|
||||||
|
|
|
@ -281,6 +281,8 @@
|
||||||
[(Hashtable: k v) (fp "(HashTable ~a ~a)" k v)]
|
[(Hashtable: k v) (fp "(HashTable ~a ~a)" k v)]
|
||||||
[(Continuation-Mark-Key: rhs)
|
[(Continuation-Mark-Key: rhs)
|
||||||
(fp "(Continuation-Mark-Key ~a)" rhs)]
|
(fp "(Continuation-Mark-Key ~a)" rhs)]
|
||||||
|
[(Prompt-Tag: body handler)
|
||||||
|
(fp "(Prompt-Tag ~a ~a)" body handler)]
|
||||||
#;[(Poly-unsafe: n b) (fp "(unsafe-poly ~a ~a ~a)" (Type-seq c) n b)]
|
#;[(Poly-unsafe: n b) (fp "(unsafe-poly ~a ~a ~a)" (Type-seq c) n b)]
|
||||||
[(Poly-names: names body)
|
[(Poly-names: names body)
|
||||||
#;(eprintf "POLY SEQ: ~a\n" (Type-seq body))
|
#;(eprintf "POLY SEQ: ~a\n" (Type-seq body))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user