From bada20a57f04626a9596a1249267d22f71453288 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Wed, 16 Jul 2014 13:08:05 +0100 Subject: [PATCH] fix documented contract for `guard-evt` et al. The `(or/c evt? any/c)` result contract is, of course, equivalent to `any/c`, but the verbose variant hopefully helps explain that `evt?` is really expected. Yes, it would be better if the result contract actually was `evt?` (and I implemented `replace-evt` that way before re-reading the `guard-evt` docs). --- .../scribblings/reference/evts.scrbl | 23 +++++++++---------- 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/pkgs/racket-pkgs/racket-doc/scribblings/reference/evts.scrbl b/pkgs/racket-pkgs/racket-doc/scribblings/reference/evts.scrbl index 34402f127f..e2dfefff49 100644 --- a/pkgs/racket-pkgs/racket-doc/scribblings/reference/evts.scrbl +++ b/pkgs/racket-pkgs/racket-doc/scribblings/reference/evts.scrbl @@ -188,7 +188,7 @@ breaks explicitly disabled---when it is not wrapped by @racket[wrap-evt], ]} -@defproc[(guard-evt [maker (-> evt?)]) evt?]{ +@defproc[(guard-evt [maker (-> (or/c evt? any/c))]) evt?]{ Creates a value that behaves as an event, but that is actually an event maker. @@ -208,7 +208,7 @@ synchronization} and whose @tech{synchronization result} is @racket[_guard].} -@defproc[(nack-guard-evt [maker (evt? . -> . evt?)]) evt?]{ +@defproc[(nack-guard-evt [maker (evt? . -> . (or/c evt? any/c))]) evt?]{ Like @racket[guard-evt], but when @racket[maker] is called, it is given a NACK (``negative acknowledgment'') event. After starting the @@ -225,7 +225,7 @@ value). If the event returned by @racket[maker] is chosen, then the NACK event never becomes @tech{ready for synchronization}.} -@defproc[(poll-guard-evt [maker (boolean? . -> . evt?)]) evt?]{ +@defproc[(poll-guard-evt [maker (boolean? . -> . (or/c evt? any/c))]) evt?]{ Like @racket[guard-evt], but when @racket[maker] is called, it is provided a boolean value that indicates whether the event will be used @@ -238,15 +238,7 @@ resulting event produces a @tech{synchronization result}, then the event will certainly be chosen for its result.} -@defthing[always-evt evt?]{A constant event that is always @tech{ready -for synchronization}, with itself as its @tech{synchronization result}. - -@examples[#:eval evt-eval - (sync always-evt) -]} - - -@defproc[(replace-evt [evt evt?] [maker (any/c ... . -> . evt?)]) evt?]{ +@defproc[(replace-evt [evt evt?] [maker (any/c ... . -> . (or/c evt? any/c))]) evt?]{ Like @racket[guard-evt], but @racket[maker] is called only after @racket[evt] becomes @tech{ready for synchronization}, and the @@ -269,6 +261,13 @@ synchronization} and whose @tech{synchronization result} is @history[#:added "6.1.0.3"]} +@defthing[always-evt evt?]{A constant event that is always @tech{ready +for synchronization}, with itself as its @tech{synchronization result}. + +@examples[#:eval evt-eval + (sync always-evt) +]} + @defthing[never-evt evt?]{A constant event that is never @tech{ready for synchronization}.