[racket] `require/typed` with a parameterized struct

From: Benjamin Greenman (blg59 at cornell.edu)
Date: Sat Dec 6 17:00:41 EST 2014

The typed racket reference shows how to require/typed a struct from an
untyped program [1]. I'd like to generalize this example to a struct with a
type parameter.

Here is the code I would like to write. How can I get this to type check?

#lang racket/base

(module UNTYPED racket/base
  (struct Tree (elem left right))
  (provide (struct-out Tree)))

(module TYPED typed/racket/base
  (require/typed 'UNTYPED
                 [#:struct (A) Tree
                   ([elem : A]
                    [left : Tree A]
                    [right : Tree A])]))

[1]
http://docs.racket-lang.org/ts-reference/special-forms.html#%28form._%28%28lib._typed-racket%2Fbase-env%2Fprims..rkt%29._require%2Ftyped%29%29
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20141206/cfadf227/attachment.html>

Posted on the users mailing list.