Adding documentation for cast and make-predicate.

Also converted tabs to spaces.
This commit is contained in:
Eric Dobson 2012-08-20 22:20:58 -07:00 committed by Sam Tobin-Hochstadt
parent 3c744229e8
commit 1248b32e73

View File

@ -277,11 +277,13 @@ cycles among them are prohibited.
(define-type (ListofPairs A) (Listof (Pair A A)))]}
@section{Generating Predicates Automatically}
@defform[(define-predicate name t)]{
Defines @racket[name] as a predicate for the type @racket[t].
@racket[name] has the type @racket[(Any -> Boolean : t)].
@racket[t] may not contain function types.}
@defform[(make-predicate t)]{
Evaluates to a predicate for the type @racket[t], with the type
@racket[(Any -> Boolean : t)]. @racket[t] may not contain function types.}
@defform[(define-predicate name t)]{
Equivalent to @racket[(define name (make-predicate t))].
@section{Type Annotation and Instantiation}
@ -303,6 +305,11 @@ This is legal only in expression contexts.}
@defform/none[#{e :: t}]{A reader abbreviation for @racket[(ann e t)].}
@defform[(cast e t)]{The entire expression has the type @racket[t], while
@racket[e] may have any type. The value of the entire expression is the value
returned by @racket[e], protected by a contract ensuring that it has type
@racket[t]. This is legal only in expression contexts.}
@defform[(inst e t ...)]{Instantiate the type of @racket[e] with types
@racket[t ...]. @racket[e] must have a polymorphic type with the
appropriate number of type variables. This is legal only in expression