typed-racket icon indicating copy to clipboard operation
typed-racket copied to clipboard

`All`'s `ooo` can't be used in `U`

Open NoahStoryM opened this issue 3 years ago • 2 comments

What version of Racket are you using?

v8.3.0.8 [cs]

What program did you run?

#lang typed/racket

(: underlying (All (A ...) [-> A ... A (U Null A ... A)]))
(define underlying (λ args (if (null? args) '() (car args))))

(displayln (underlying '()))
(displayln (underlying '(123 "123")))

What should have happened?

Print

()
123

If you got an error message, please include it here.

Type Checker: parse error in type;
 type variable must be used with ...
  variable: A
  in: A

NoahStoryM avatar Dec 07 '21 14:12 NoahStoryM

This could definitely be a better error message but I don't think we know how to make this actually work.

samth avatar Dec 07 '21 14:12 samth

I tried to use ooo in the List as the return value's type, so I thought it was allowed for type constructors:

#lang typed/racket

(: underlying (All (A ...) [-> A ... A (U Null (List A ... A))]))
(define underlying (λ args (if (null? args) '() args)))

(displayln (underlying '()))
(displayln (underlying '(123 "123")))

I want to know in which cases we can use ooo? I don't find a detailed description in the documentation (maybe I overlooked it ).

NoahStoryM avatar Dec 07 '21 15:12 NoahStoryM