
Moving to eager propagating of bottom works for most cases,
but in some cases flattening types such as (Pairof Bottom Any)
to Bottom made things like type inference break for some cases
(since (Listof Nothing) == Null, and (Listof A) did not structurally
like up like it used to). Perhaps w/ a little more effort
inference and any other potential issues could work better
with propagating bottom, but for now we'll be slightly less
aggressive about it.
i.e. this fixes pfds, which commit 8e7f390
broke.
17 lines
385 B
Racket
17 lines
385 B
Racket
#lang typed/racket
|
|
|
|
(define-type (Promiseof A) (Boxof (U (→ (Listof A)) (Listof A))))
|
|
(struct: (A) Queue ([fld : (Promiseof A)]))
|
|
|
|
(define-syntax-rule (empty A)
|
|
((inst Queue A) (box (lambda: () '()))))
|
|
|
|
(: empty? : (All (A) ((Queue A) -> Boolean)))
|
|
(define (empty? q)
|
|
(null? (Queue-fld q)))
|
|
|
|
;; make sure that inference works on nested 'Nothing' types
|
|
(empty? (empty Nothing))
|
|
|
|
|