Make simple static contracts not combinators.
original commit: 9eea867e9afc22246edafdd091d2d2a832986eee
This commit is contained in:
parent
30a88b5909
commit
eec8723205
|
@ -19,7 +19,7 @@
|
|||
[flat/sc? predicate/c]))
|
||||
|
||||
(define (simple-contract-write-proc v port mode)
|
||||
(match-define (simple-contract _ syntax kind) v)
|
||||
(match-define (simple-contract syntax kind) v)
|
||||
(define-values (open close)
|
||||
(if (equal? mode 0)
|
||||
(values "(" ")")
|
||||
|
@ -32,16 +32,16 @@
|
|||
|
||||
|
||||
|
||||
(struct simple-contract combinator (syntax kind)
|
||||
(struct simple-contract static-contract (syntax kind)
|
||||
#:methods gen:sc
|
||||
[(define (sc-map v f) v)
|
||||
(define (sc->contract v f) (simple-contract-syntax v))
|
||||
(define (sc->constraints v f) (simple-contract-restrict (simple-contract-kind v)))]
|
||||
#:methods gen:custom-write [(define write-proc simple-contract-write-proc)])
|
||||
|
||||
(define (flat/sc ctc) (simple-contract null ctc 'flat))
|
||||
(define (chaperone/sc ctc) (simple-contract null ctc 'chaperone))
|
||||
(define (impersonator/sc ctc) (simple-contract null ctc 'impersonator))
|
||||
(define (flat/sc ctc) (simple-contract ctc 'flat))
|
||||
(define (chaperone/sc ctc) (simple-contract ctc 'chaperone))
|
||||
(define (impersonator/sc ctc) (simple-contract ctc 'impersonator))
|
||||
|
||||
(define (flat/sc? sc)
|
||||
(and (simple-contract? sc)
|
||||
|
|
|
@ -13,10 +13,10 @@
|
|||
[body static-contract?]))
|
||||
(struct recursive-contract-use ([name identifier?]))
|
||||
(struct combinator ([args sequence?]))
|
||||
(struct static-contract ())
|
||||
[sc-map (static-contract? (static-contract? variance/c . -> . static-contract?) . -> . static-contract?)]
|
||||
[sc->contract (static-contract? (static-contract? . -> . syntax?) . -> . syntax?)]
|
||||
[sc->constraints (static-contract? (static-contract? . -> . contract-restrict?) . -> . contract-restrict?)]
|
||||
[static-contract? predicate/c]
|
||||
[sc? predicate/c]
|
||||
)
|
||||
|
||||
|
@ -135,7 +135,7 @@
|
|||
|
||||
;; Super struct of static contract combinators.
|
||||
;; Provides printing functionality.
|
||||
;; - args : (listof static-contract?)
|
||||
;; - args : (sequenceof static-contract?)
|
||||
(struct combinator static-contract (args)
|
||||
#:transparent
|
||||
#:property prop:combinator-name "combinator/sc"
|
||||
|
|
Loading…
Reference in New Issue
Block a user