File tree Expand file tree Collapse file tree 4 files changed +7
-10
lines changed
typed-racket-lib/typed-racket
static-contracts/combinators
typed-racket-test/unit-tests Expand file tree Collapse file tree 4 files changed +7
-10
lines changed Original file line number Diff line number Diff line change 13111311[treelist-cons (-poly (a) (-> (-treelist a) a (-treelist a)))]
13121312[treelist-delete (-poly (a) (-> (-treelist a) -Index (-treelist a)))]
13131313[make-treelist (-poly (a) (-> -Nat a (-treelist a)))]
1314- [treelist-ref (-poly (a) (-> (-treelist a) -Index a))]
1314+ [treelist-ref (-poly (a) (-> (-treelist a) -Index a :T+ #f ))]
13151315[treelist-insert (-poly (a) (-> (-treelist a) -Index a (-treelist a)))]
13161316[treelist-set (-poly (a) (-> (-treelist a) -Index a (-treelist a)))]
13171317[treelist-take (-poly (a) (-> (-treelist a) -Index (-treelist a)))]
13301330[treelist-map (-poly (a b) (-> (-treelist a) (-> a b) (-treelist b)))]
13311331[treelist-for-each (-poly (a b) (-> (-treelist a) (-> a b) -Void))]
13321332[treelist-filter (-poly (a) (-> (-> a Univ) (-treelist a) (-treelist a)))]
1333- [treelist-find (-poly (a) (-> (-treelist a) (-> a Univ) a))]
1333+ [treelist-find (-poly (a) (-> (-treelist a) (-> a Univ) a :T+ #f ))]
13341334[treelist-index-of
13351335 (-poly (a)
13361336 (cl->* ((-treelist a) a . -> . -Index)
13371337 ((-treelist a) a (-> a a Univ) . -> . -Index)))]
1338- [treelist-flatten (-poly (a) ( -> a (-treelist a)))] ;; This type isn't any more or less pratical than Univ, but Univ might not be sound
1339- [treelist-append* (-poly (a) (-> (-treelist (-treelist a)) (-treelist a)))] ;; Same type specificty issue as above
1338+ [treelist-flatten (Univ . -> . (-treelist Univ))]
1339+ [treelist-append* (-poly (a) (-> (-treelist (-treelist a)) (-treelist a)))]
13401340[treelist-sort
13411341(-poly
13421342 (a b)
Original file line number Diff line number Diff line change 354354 [#:mask mask:set])
355355
356356;;------
357- ;; Treelist
357+ ;; Treelist (Immutable)
358358;;------
359359
360- ;; TODO separate mutable/immutable treelist types
361360(def-structural TreeList ([elem #:covariant ])
362361 [#:mask mask:treelist])
363362
Original file line number Diff line number Diff line change 3131(define set?/sc (flat/sc #'(lambda (x) (or (set? x) (set-mutable? x) (set-weak? x)))))
3232(define empty-set/sc (and/sc set?/sc (flat/sc #'set-empty? )))
3333
34- ;; TODO: Split TreeList into Mutable and Immutable
3534(define treelist?/sc (flat/sc #'treelist? ))
3635(define empty-treelist/sc (and/sc treelist?/sc (flat/sc #'treelist-empty? )))
3736
Original file line number Diff line number Diff line change 19511951 (tc-e (treelist-for-each (treelist "a " "b " ) (λ (x) x)) -Void)
19521952 (tc-e (treelist-find (treelist "a " "b " ) (λ (x) (if (equal? x "a " ) #t #f ))) -String)
19531953 (tc-e (treelist-filter even? (treelist 1 2 3 4 5 )) (-treelist -PosByte))
1954- (tc-e (treelist-flatten (treelist (treelist (treelist (treelist "a " )))))
1955- (-treelist (-treelist (-treelist (-treelist (-treelist -String)))))) ;;FIXME: this type is unpleasant
1956- (tc-e (treelist-flatten "a " ) (-treelist -String))
1954+ (tc-e (treelist-flatten (treelist (treelist (treelist (treelist "a " ))))) (-treelist Univ))
1955+ (tc-e (treelist-flatten "a " ) (-treelist Univ))
19571956 (tc-e (treelist-append* (treelist (treelist "a " "b " ) (treelist "c " (treelist "d " ) "e " ) (treelist))) (-treelist Univ))
19581957 (tc-e (treelist-index-of (treelist "a " "b " "c " ) "b " ) -Index)
19591958 (tc-e (treelist-index-of (treelist "a " "b " "c " ) "b " equal?) -Index)
You can’t perform that action at this time.
0 commit comments