Add contracts for `Sequenceof' values.

original commit: eaa156554a5c5305d147371bec0619436a0e7993
This commit is contained in:
Sam Tobin-Hochstadt 2011-06-15 17:01:49 -04:00
parent c96832caba
commit a431e7b5c7
2 changed files with 14 additions and 0 deletions

View File

@ -0,0 +1,12 @@
#lang racket/load
(module m typed/racket
(provide s)
(: s (Sequenceof Integer))
(define s (list 1 2 3)))
(module n racket
(require 'm)
(for ([i s]) (add1 i)))
(require 'n)

View File

@ -16,6 +16,7 @@
(only-in scheme/contract -> ->* case-> cons/c flat-rec-contract provide/contract any/c)
(for-template scheme/base racket/contract racket/set (utils any-wrap)
(prefix-in t: (types numeric-predicates))
(only-in unstable/contract sequence/c)
(only-in scheme/class object% is-a?/c subclass?/c object-contract class/c init object/c class?)))
(define (define/fixup-contract? stx)
@ -185,6 +186,7 @@
#'(or/c . cnts)))]
[(and t (Function: _)) (t->c/fun t)]
[(Set: t) #`(set/c #,(t->c t))]
[(Sequence: ts) #`(sequence/c #,@(map t->c ts))]
[(Vector: t)
(if flat?
#`(vectorof #,(t->c t #:flat #t) #:flat? #t)