xexpr/c usage

svn: r13316
This commit is contained in:
Jay McCarthy 2009-01-29 16:22:10 +00:00
parent f27d2df5a2
commit 9f48c1a4d2
6 changed files with 14 additions and 14 deletions

View File

@ -68,7 +68,7 @@
; Contracts ; Contracts
(define xexpr-forest/c (define xexpr-forest/c
(listof xexpr?)) (listof xexpr/c))
(define (formlet/c c) (define (formlet/c c)
(integer? . -> . (integer? . -> .

View File

@ -5,7 +5,7 @@
(provide/contract (provide/contract
[send/formlet (((formlet/c any/c)) [send/formlet (((formlet/c any/c))
(#:wrap (xexpr? . -> . response?)) (#:wrap (xexpr/c . -> . response?))
. ->* . any/c)]) . ->* . any/c)])
(define (send/formlet f (define (send/formlet f
@ -23,7 +23,7 @@
,@(formlet-display f))))))) ,@(formlet-display f)))))))
(provide/contract (provide/contract
[embed-formlet (embed/url/c (formlet/c any/c) . -> . xexpr?)]) [embed-formlet (embed/url/c (formlet/c any/c) . -> . xexpr/c)])
(define (embed-formlet embed/url f) (define (embed-formlet embed/url f)
`(form ([action ,(embed/url `(form ([action ,(embed/url

View File

@ -128,7 +128,7 @@ These combinators may be used directly to construct low-level formlets, such as
types. Refer to @secref["input-formlets"] for example low-level formlets using these combinators. types. Refer to @secref["input-formlets"] for example low-level formlets using these combinators.
@defthing[xexpr-forest/c contract?]{ @defthing[xexpr-forest/c contract?]{
Equivalent to @scheme[(listof xexpr?)] Equivalent to @scheme[(listof xexpr/c)]
} }
@defproc[(formlet/c [content any/c]) contract?]{ @defproc[(formlet/c [content any/c]) contract?]{
@ -165,7 +165,7 @@ types. Refer to @secref["input-formlets"] for example low-level formlets using t
Constructs a @tech{formlet} with the rendering @scheme[r] and the identity procedure as the processing step. Constructs a @tech{formlet} with the rendering @scheme[r] and the identity procedure as the processing step.
} }
@defproc[(xml [r xexpr?]) @defproc[(xml [r xexpr/c])
(formlet/c procedure?)]{ (formlet/c procedure?)]{
Equivalent to @scheme[(xml-forest (list r))]. Equivalent to @scheme[(xml-forest (list r))].
} }
@ -228,7 +228,7 @@ A few utilities are provided for using @tech{formlet}s in Web applications.
@defproc[(send/formlet [f (formlet/c any/c)] @defproc[(send/formlet [f (formlet/c any/c)]
[#:wrap wrapper [#:wrap wrapper
(xexpr? . -> . response?) (xexpr/c . -> . response?)
(lambda (form-xexpr) (lambda (form-xexpr)
`(html (head (title "Form Entry")) `(html (head (title "Form Entry"))
(body ,form-xexpr)))]) (body ,form-xexpr)))])
@ -241,7 +241,7 @@ A few utilities are provided for using @tech{formlet}s in Web applications.
@defproc[(embed-formlet [embed/url embed/url/c] @defproc[(embed-formlet [embed/url embed/url/c]
[f (formlet/c any/c)]) [f (formlet/c any/c)])
xexpr?]{ xexpr/c]{
Like @scheme[send/formlet], but for use with @scheme[send/suspend/dispatch]. Like @scheme[send/formlet], but for use with @scheme[send/suspend/dispatch].
} }

View File

@ -34,7 +34,7 @@
the request is returned to this continuation. the request is returned to this continuation.
} }
@defproc[(send/suspend/hidden [response-generator (url? xexpr? . -> . response?)]) @defproc[(send/suspend/hidden [response-generator (url? xexpr/c . -> . response?)])
request?]{ request?]{
Captures the current continuation. Serializes it and generates an INPUT Captures the current continuation. Serializes it and generates an INPUT
form that includes the serialization as a hidden form. form that includes the serialization as a hidden form.

View File

@ -192,4 +192,4 @@
;; END OF TEST ;; END OF TEST
(provide read-plist) (provide read-plist)
(provide/contract [write-plist (xexpr? output-port? . -> . void?)])) (provide/contract [write-plist (xexpr/c output-port? . -> . void?)]))

View File

@ -245,16 +245,16 @@ like @scheme[display-xml].}
and leave them in place in the resulting ``@tech{X-expression}''. and leave them in place in the resulting ``@tech{X-expression}''.
} }
@defproc[(xml->xexpr [content content?]) xexpr?]{ @defproc[(xml->xexpr [content content?]) xexpr/c]{
Converts document content into an @tech{X-expression}, using Converts document content into an @tech{X-expression}, using
@scheme[permissive?] to determine if foreign objects are allowed.} @scheme[permissive?] to determine if foreign objects are allowed.}
@defproc[(xexpr->xml [xexpr xexpr?]) content?]{ @defproc[(xexpr->xml [xexpr xexpr/c]) content?]{
Converts an @tech{X-expression} into XML content.} Converts an @tech{X-expression} into XML content.}
@defproc[(xexpr->string [xexpr xexpr?]) string?]{ @defproc[(xexpr->string [xexpr xexpr/c]) string?]{
Converts an @tech{X-expression} into a string containing XML.} Converts an @tech{X-expression} into a string containing XML.}
@ -376,12 +376,12 @@ could be create by an expression matching the following
(list 'array pl-value ...)] (list 'array pl-value ...)]
] ]
@defproc[(read-plist [in input-port?]) xexpr?]{ @defproc[(read-plist [in input-port?]) xexpr/c]{
Reads a plist from a port, and produces a @tech{dictionary Reads a plist from a port, and produces a @tech{dictionary
X-expression}.} X-expression}.}
@defproc[(write-plist [dict xexpr?] [out output-port?]) void?]{ @defproc[(write-plist [dict xexpr/c] [out output-port?]) void?]{
Write a plist to the given port. If @scheme[dict] is not a Write a plist to the given port. If @scheme[dict] is not a
@tech{dictionary X-expression}, the @scheme[exn:fail:contract] @tech{dictionary X-expression}, the @scheme[exn:fail:contract]