Add back some special cases.

original commit: 7eaae20f41e0b5bbbe90af0461e24f9aef1b2931
This commit is contained in:
Sam Tobin-Hochstadt 2012-08-07 15:35:27 -04:00
parent ce41c349e6
commit 30e80ee604

View File

@ -34,9 +34,17 @@
[(Union: es) es]
[_ (list t)]))
(define empty-union (make-Union null))
;; Union constructor
;; Normalizes representation by sorting types.
;; Type * -> Type
;; The input types can overlap and be union types
(define (Un . args)
(make-union* (foldr merge '() (remove-dups (sort (append-map flat args) type<?)))))
(define Un
(case-lambda
[() empty-union]
[(t) t]
[args
(define ts (foldr merge '()
(remove-dups (sort (append-map flat args) type<?))))
(make-union* ts)]))