<div dir="ltr">It makes no sense to ask the type system to distinguish a Tree of Integers from a Tree of Symbols? Basically, I have an informal requirement (trees are homogenous) from the untyped world that I want to formalize through require/typed and check statically.</div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Dec 6, 2014 at 5:40 PM, Matthias Felleisen <span dir="ltr"><<a href="mailto:matthias@ccs.neu.edu" target="_blank">matthias@ccs.neu.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div><br></div><div>This makes no sense. Parametric polymorphism is a syntactic concept (think for-all quantifier). It's sad enough that we export such things from typed to untyped modules (for pragmatic reasons, in violation of a fundamental GT assumption). -- Matthias</div><div><br></div><div><br></div><div><br></div><div><br></div><br><div><div><div class="h5"><div>On Dec 6, 2014, at 5:00 PM, Benjamin Greenman wrote:</div><br></div></div><blockquote type="cite"><div><div class="h5"><div dir="ltr">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.<div><br></div><div>Here is the code I would like to write. How can I get this to type check?</div><div><br></div><div><div><font face="monospace">#lang racket/base</font></div><div><font face="monospace"><br></font></div><div><font face="monospace">(module UNTYPED racket/base</font></div><div><font face="monospace">  (struct Tree (elem left right))</font></div><div><font face="monospace">  (provide (struct-out Tree)))</font></div><div><font face="monospace"><br></font></div><div><font face="monospace">(module TYPED typed/racket/base</font></div><div><font face="monospace">  (require/typed 'UNTYPED</font></div><div><font face="monospace">                 [#:struct (A) Tree</font></div><div><font face="monospace">                   ([elem : A]</font></div><div><font face="monospace">                    [left : Tree A]</font></div><div><font face="monospace">                    [right : Tree A])]))</font></div></div><div><br></div><div>[1] <a href="http://docs.racket-lang.org/ts-reference/special-forms.html#%28form._%28%28lib._typed-racket%2Fbase-env%2Fprims..rkt%29._require%2Ftyped%29%29" target="_blank">http://docs.racket-lang.org/ts-reference/special-forms.html#%28form._%28%28lib._typed-racket%2Fbase-env%2Fprims..rkt%29._require%2Ftyped%29%29</a></div></div></div></div>
____________________<br>  Racket Users list:<br>  <a href="http://lists.racket-lang.org/users" target="_blank">http://lists.racket-lang.org/users</a><br></blockquote></div><br></div></blockquote></div><br></div>