From d69957455ccd0d8fc59dabc61f018068e0f9a967 Mon Sep 17 00:00:00 2001 From: Robby Findler Date: Sat, 13 Sep 2008 22:37:16 +0000 Subject: [PATCH] a bunch more values are now converted into contracts automatically (added bytes) svn: r11730 --- collects/scheme/private/contract-guts.ss | 2 +- collects/scribblings/reference/contracts.scrbl | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/collects/scheme/private/contract-guts.ss b/collects/scheme/private/contract-guts.ss index 02027df8db..7fd9f80c40 100644 --- a/collects/scheme/private/contract-guts.ss +++ b/collects/scheme/private/contract-guts.ss @@ -146,7 +146,7 @@ [(and (procedure? x) (procedure-arity-includes? x 1)) (make-predicate-contract (or (object-name x) '???) x)] [(or (symbol? x) (boolean? x) (char? x)) (make-eq-contract x)] - [(string? x) (make-equal-contract x)] + [(or (byte-string? x) (string? x) (make-equal-contract x)] [(number? x) (make-=-contract x)] [(or (regexp? x) (byte-regexp? x)) (make-regexp/c x)] [else #f])) diff --git a/collects/scribblings/reference/contracts.scrbl b/collects/scribblings/reference/contracts.scrbl index bcc86d7c56..efcb6d0214 100644 --- a/collects/scribblings/reference/contracts.scrbl +++ b/collects/scribblings/reference/contracts.scrbl @@ -16,8 +16,8 @@ associating a contract with a binding. Note that all of the combinators that accept contracts as arguments use @scheme[coerce-contract], meaning that symbols, booleans, strings, -characters, numbers, regular expressions, and predicates are all -implicitly converted into contracts. +bytess, characters, numbers, regular expressions, and predicates +are all implicitly converted into contracts. @note-lib[scheme/contract #:use-sources (scheme/private/contract-ds scheme/private/contract @@ -909,11 +909,11 @@ If @scheme[x] is a contract, it returns it. If it is a procedure of arity one, it converts that into a contract by treating the result as a predicate. If it is a symbol, boolean, or character, it makes a contract that accepts values that are @scheme[eq?] to @scheme[x]. If -@scheme[x] is a string, it makes a contract that accespts values that -are @scheme[equal?] to @scheme[x]. If @scheme[x] is a regular -expression or a byte regular expression, it makes a contract that -accepts strings and bytes, as long as they match the regular -expression. +@scheme[x] is a string or a bytes, it makes a contract that +accespts values that are @scheme[equal?] to @scheme[x]. If @scheme[x] +is a regular expression or a byte regular expression, it makes a +contract that accepts strings and bytes, as long as they match the +regular expression. If @scheme[x] is none of the above, @scheme[coerce-contract] signals an error, using the first argument in the error