typed-racket
typed-racket copied to clipboard
`All`'s `ooo` can't be used in `U`
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?
()
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
This could definitely be a better error message but I don't think we know how to make this actually work.
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 ).