[racket-dev] Catching the undefined value
On 2014-04-15 21:19:16 -0600, Neil Toronto wrote:
> Does TR not having to worry about #<undefined> mean that the following
> program will typecheck?
>
> #lang typed/racket
>
> (define-type (Lazy-Listof A) (Promise (Pair A (Lazy-Listof A))))
>
> (let ()
> (define: lazy-zeros : (Lazy-Listof Zero)
> (delay (cons 0 lazy-zeros)))
> lazy-zeros)
Yes, that should be the case. Here's an interaction from my pull request branch
for removing undefined handling in TR:
Welcome to Racket v6.0.1.3.
-> (define-type (Lazy-Listof A) (Promise (Pair A (Lazy-Listof A))))
-> (let ()
(define: lazy-zeros : (Lazy-Listof Zero)
(delay (cons 0 lazy-zeros)))
lazy-zeros)
- : (Lazy-Listof Zero)
#<promise:lazy-zeros>
That's assuming there aren't any design problems with that PR that come
up in code review.
> BTW, I was happy to see that the type `Lazy-Listof' could be defined like
> that when coming up with the example.
:D
Cheers,
Asumu