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
|
@ -108,10 +108,21 @@
|
||||||
|
|
||||||
(define (contract? x) (and (coerce-contract/f x) #t))
|
(define (contract? x) (and (coerce-contract/f x) #t))
|
||||||
|
|
||||||
(define (flat-contract? x)
|
(define (flat-contract? x)
|
||||||
(let ([c (coerce-contract/f x)])
|
(or (and (procedure? x) (procedure-arity-includes? x 1))
|
||||||
(and c
|
(null? x)
|
||||||
(flat-contract-struct? c))))
|
(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)
|
(define (chaperone-contract? x)
|
||||||
(let ([c (coerce-contract/f x)])
|
(let ([c (coerce-contract/f x)])
|
||||||
|
|
Loading…
Reference in New Issue
Block a user