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

From: Eric Dobson (eric.n.dobson at gmail.com)
Date: Wed Aug 7 00:53:14 EDT 2013

I'm assuming you mean parametric contracts instead of polymorphic. But
not sure why those would be the correct solution, I think any/c would
work, I'm not seeing a case where wrapping the value would protect
anything.

I don't see a fundamental limitation to doing this either.

On Tue, Aug 6, 2013 at 2:56 PM, Asumu Takikawa <asumu at ccs.neu.edu> wrote:
> Hi all,
>
> Does anyone know why Typed Racket does not support importing polymorphic
> structs using the #:struct keyword in `require/typed`? Is this a
> fundamental limitation or just a "small matter of programming"?
>
> i.e., I want to do something like
>   (require/typed lang/posn
>     [#:struct posn (A) ([x : A] [y: A])])
>
> This seems like it could be supported by the contract system in most
> cases (with polymorphic contracts on accessors and constructors). The
> case in which it wouldn't work is if you wanted to export a struct
> instance with a polymorphic type from the untyped module.
>
> Cheers,
> Asumu
> ____________________
>   Racket Users list:
>   http://lists.racket-lang.org/users

Posted on the users mailing list.