[racket] applying polymorphic functions in TR
On 2014-02-16 09:53:21 -0500, Bloch Stephen wrote:
> > (define-type A Integer) ; or whatever
> > (define-type B String)
> > (ann time-apply ((A A -> B) (List A A) -> (Values (List B)
> Nonnegative-Integer Nonnegative-Integer Nonnegative-Integer)))
You probably want `inst` here instead, which instantiates the type
variables in its first argument. For example:
((inst time-apply String Integer Integer) ; b -> String
; a ... -> Integer Integer
(lambda: ([x : Integer] [y : Integer]) "foo")
'(1 2))
It would be nice if inference were smart enough so that this worked:
(time-apply (lambda: ([x : Integer] [y : Integer]) "foo") '(1 2))
but it doesn't seem to be yet.
Cheers,
Asumu