Today I got a surprising type error that I think is worth sharing.

(: my-force (All (A) (-> (-> A) A))
(define (my-force x) (x))

(my-force (lambda () (values (void) (void)))
;; ERROR! 'my-force' cannot be applied to argument.
;; expected "(-> A)", got "(-> (values Void Void))"
;; result type "A", expected result "AnyValues"

(inst my-force (Values Void Void))
;; Parse Error in type: "Values" is unbound

That is all. I see now that Values is only allowed in result positions
<http://docs.racket-lang.org/ts-reference/type-ref.html?q=values#%28form._%28%28lib._typed-racket%2Fbase-env%2Fbase-types-extra..rkt%29._.Values%29%29>,
but I'd still expected this to work.
____________________
  Racket Users list:
  http://lists.racket-lang.org/users

Reply via email to