macrotypes/sysf-tests.rkt
2014-08-15 15:32:54 -04:00

9 lines
314 B
Racket

#lang s-exp "sysf.rkt"
;; polymorphic tests
(define-type (Maybe X) (variant (None) (Just X)))
(check-type (None {Int}) : (Maybe Int))
(check-type (Just {Int} 1) : (Maybe Int))
(check-type-error (Just {Int} #f))
(check-not-type (Just {Int} 1) : (Maybe Bool))
(check-type (λ {X} ([x : X]) x) : ( (X) ( X X)))