typed-racket/typed-racket-test/succeed/vec-len-in-struct-fld.rkt
Andrew Kent 8aa05bebff add dependent function types (#584)
Adds the following:
+ dependent function Types
+ some existential object support when applying
  dependent functions
+ simplify linear arith support
+ add unsafe-require/typed/provide
2017-09-25 12:52:33 -04:00

9 lines
182 B
Racket

#lang typed/racket/base
(struct: Foo ([fld : VectorTop]) #:transparent)
(: bar (Foo -> Index))
(define (bar p)
(define n (vector-length (Foo-fld p)))
(if (zero? n) 0 (- n 1)))