special case the flat-contract? predicate to avoid having
to create the whole contract struct for values that get coerced to flat contracts
This commit is contained in:
parent
003e8c7870
commit
2b9d855231
|
@ -109,9 +109,20 @@
|
|||
(define (contract? x) (and (coerce-contract/f x) #t))
|
||||
|
||||
(define (flat-contract? x)
|
||||
(let ([c (coerce-contract/f x)])
|
||||
(and c
|
||||
(flat-contract-struct? c))))
|
||||
(or (and (procedure? x) (procedure-arity-includes? x 1))
|
||||
(null? x)
|
||||
(boolean? x)
|
||||
(symbol? x)
|
||||
(keyword? x)
|
||||
(char? x)
|
||||
(bytes? x)
|
||||
(string? x)
|
||||
(number? x)
|
||||
(regexp? x)
|
||||
(byte-regexp? x)
|
||||
(let ([c (coerce-contract/f x)])
|
||||
(and c
|
||||
(flat-contract-struct? c)))))
|
||||
|
||||
(define (chaperone-contract? x)
|
||||
(let ([c (coerce-contract/f x)])
|
||||
|
|
Loading…
Reference in New Issue
Block a user