Test for appropriate predicates for invariant structs.

This commit is contained in:
Sam Tobin-Hochstadt 2012-09-27 17:26:10 -04:00
parent ee4ba2e3dd
commit cab90c16d5

View File

@ -0,0 +1,14 @@
#lang typed/racket
(struct: (A) x ([f : (A -> A)]))
(struct: (B) y ([f : (x B)]))
(: f : (U Integer (y Integer)) -> Integer)
(define (f v)
(if (y? v)
((x-f (y-f v)) 0)
v))
(f 17)
(f (y (x (lambda: ([n : Integer]) (+ 2 n)))))