7.7 Legacy Contracts
(make-proj-contract name proj first-order) → contract? | |||||||||||||||||
name : any/c | |||||||||||||||||
| |||||||||||||||||
first-order : (-> any/c boolean?) |
Builds a contract using an old interface.
Modulo errors, it is equivalent to:
(make-contract #:name name #:first-order first-order #:projection (cond [(procedure-arity-includes? proj 5) (lambda (blame) (proj (blame-positive blame) (blame-negative blame) (list (blame-source blame) (blame-value blame)) (blame-contract blame) (not (blame-swapped? blame))))] [(procedure-arity-includes? proj 4) (lambda (blame) (proj (blame-positive blame) (blame-negative blame) (list (blame-source blame) (blame-value blame)) (blame-contract blame)))]))
| ||||||||||||||||||||||||||||||||||||||||||
val : any/c | ||||||||||||||||||||||||||||||||||||||||||
src : any/c | ||||||||||||||||||||||||||||||||||||||||||
pos : any/c | ||||||||||||||||||||||||||||||||||||||||||
name : any/c | ||||||||||||||||||||||||||||||||||||||||||
fmt : string? | ||||||||||||||||||||||||||||||||||||||||||
arg : any/c |
Calls raise-blame-error after building a blame struct from
the val, src, pos, and name arguments.
The fmt string and following arguments are passed to
format and used as the string in the error message.
(contract-proc c) | |||||||
| |||||||
c : contract? |
Constructs an old-style projection from a contract.
The resulting function accepts the information that is in a blame struct and returns a projection function that checks the contract.