From 9a6176ae5856f2896692d1b42ccb34f7d6d44119 Mon Sep 17 00:00:00 2001 From: Matthew Butterick Date: Wed, 19 Aug 2015 15:56:36 -0700 Subject: [PATCH] update contract --- decode.rkt | 6 +++--- scribblings/decode.scrbl | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/decode.rkt b/decode.rkt index c7f310b..7dd7054 100644 --- a/decode.rkt +++ b/decode.rkt @@ -20,7 +20,7 @@ [(or (list? x) (hash? x) (vector? x)) (format "~v" x)] ; ok to convert datatypes [else (error)])))) ; but things like procedures should throw an error -(define decode-proc-output-contract (or/c xexpr? (non-empty-listof xexpr?))) +(define decode-proc-output-contract (or/c xexpr/c (non-empty-listof xexpr/c))) (define (->list/tx x) @@ -54,7 +54,7 @@ #:entity-proc ((or/c symbol? valid-char?) . -> . decode-proc-output-contract) #:cdata-proc (cdata? . -> . decode-proc-output-contract) #:exclude-tags (listof txexpr-tag?) - #:exclude-attrs txexpr-attrs?) . ->* . txexpr?) + #:exclude-attrs txexpr-attrs?) . ->* . (or/c xexpr/c (non-empty-listof xexpr/c))) (let loop ([x tx-in]) (cond [(txexpr? x) (let-values([(tag attrs elements) (txexpr->values x)]) @@ -120,7 +120,7 @@ #:entity-proc ((or/c symbol? valid-char?) . -> . decode-proc-output-contract) #:cdata-proc (cdata? . -> . decode-proc-output-contract) #:exclude-tags (listof txexpr-tag?) - #:exclude-attrs txexpr-attrs?) . ->* . txexpr?) + #:exclude-attrs txexpr-attrs?) . ->* . (or/c xexpr/c (non-empty-listof xexpr/c))) (define temp-tag (gensym "temp-tag")) (define decode-result (decode `(temp-tag ,@elements) diff --git a/scribblings/decode.scrbl b/scribblings/decode.scrbl index 6234811..6ba689d 100644 --- a/scribblings/decode.scrbl +++ b/scribblings/decode.scrbl @@ -36,7 +36,7 @@ Another example is conversion of output into a particular data format. Most Poll [#:exclude-tags tags-to-exclude (listof txexpr-tag?) null] [#:exclude-attrs attrs-to-exclude txexpr-attrs? null] ) -txexpr?] +(or/c xexpr/c (non-empty-listof xexpr/c))] Recursively process a @racket[_tagged-xexpr], usually the one exported from a Pollen source file as @racket[doc]. This function doesn't do much on its own. Rather, it provides the hooks upon which harder-working functions can be hung. @@ -231,7 +231,7 @@ Finally, the @racket[_attrs-to-exclude] argument works the same way as @racket[_ [#:exclude-tags tags-to-exclude (listof txexpr-tag?) null] [#:exclude-attrs attrs-to-exclude txexpr-attrs? null] ) -txexpr-elements?] +(or/c xexpr/c (non-empty-listof xexpr/c))] Identical to @racket[decode], but takes @racket[txexpr-elements?] as input rather than a whole tagged X-expression, and likewise returns @racket[txexpr-elements?] rather than a tagged X-expression. A convenience variant for use inside tag functions. @section{Block}