Typed Racket provides some additional utility functions to facilitate typed programming.
Verifies that the argument satisfies the constraint. If no predicate
is provided, simply checks that the value is not
See also the cast form.
Guard the body with assertions. If any of the assertions fail, the
program errors. These assertions behave like assert
A predicate for the Index
(typecheck-fail orig-stx maybe-msg maybe-id)
|maybe-msg|| ||=|| |
| || ||||| ||msg-string|
| || || || || |
|maybe-id|| ||=|| |
| || ||||| ||#:covered-id id|
Explicitly produce a type error, with the source location or
orig-stx. If msg-string is present, it must be a literal string, it is used as
the error message, otherwise the error message
"Incomplete case coverage" is used.
If id is present and has
type T, then the message "missing coverage of T" is added to
the error message.
Type Checker: Expected Boolean, but got (Syntaxof (List
'typecheck-fail-internal (List 'cond* 'x (List (List
'string? 'x) True) (List (List 'exact-nonnegative-integer?
'x) False)) String 'x))