[racket] applying polymorphic functions in TR

From: Asumu Takikawa (asumu at ccs.neu.edu)
Date: Sun Feb 16 11:03:34 EST 2014

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

Posted on the users mailing list.