[racket] Typed Racket and require/typed for polymorphic structs

From: Asumu Takikawa (asumu at ccs.neu.edu)
Date: Wed Aug 7 11:32:25 EDT 2013

On 2013-08-07 08:18:41 -0700, Eric Dobson wrote:
> Ok, now I'm not so sure it is possible. Can you give what you think
> the contracts should be for your posn example? The issue that I see is
> that the parametricity is shared across different functions and I
> don't know how that is represented with racket contracts.

The contracts should be something like
  make-posn  -->  (-> X Y (posn X Y))
  posn-x     -->  (-> (posn X Y) X)
  posn-y     -->  (-> (posn X Y) Y)

  where X = (new-∀/c 'X)
        Y = (new-∀/c 'Y)

This is similar to how `contract-out` works with the #:exists and
#:forall keywords.


Posted on the users mailing list.