<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">Why not create an intermediary module? Create a typed module, call it <font face="Courier" class="">typed/data-defn</font>, and use <font face="Courier" class="">require/typed/provide</font> to import the struct and provide it. Then just require that module for all other modules that need to use that struct in a typed context.</div><br class=""><div><blockquote type="cite" class=""><div class="">On Feb 5, 2015, at 21:10, Benjamin Greenman <<a href="mailto:blg59@cornell.edu" class="">blg59@cornell.edu</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">I've got three modules:<div class="">- One untyped module defines some structs</div><div class="">- One typed module defines some helper functions</div><div class="">- One typed module does some interesting things</div><div class=""><br class=""></div><div class="">I've also got a problem: I cannot share imported untyped structs between the typed modules.</div><div class=""><br class=""></div><div class="">The problem goes away if I linearize the module dependencies, but I'd prefer not to do that -- the situation I have in real life uses two orthogonal modules of helper functions (so the overall inheritance graph is a diamond).</div><div class=""><br class=""></div><div class="">Here's the minimal example. Can we at least make the error message more helpful?</div><div class=""><br class=""></div><div class=""><div class=""><font face="monospace, monospace" class="">#lang racket/base</font></div><div class=""><font face="monospace, monospace" class=""><br class=""></font></div><div class=""><font face="monospace, monospace" class="">(module data-defn racket/base</font></div><div class=""><font face="monospace, monospace" class=""> (provide (struct-out foo))</font></div><div class=""><font face="monospace, monospace" class=""> (struct foo ()))</font></div><div class=""><font face="monospace, monospace" class=""><br class=""></font></div><div class=""><font face="monospace, monospace" class="">(module utils typed/racket/base</font></div><div class=""><font face="monospace, monospace" class=""> (provide foo->string)</font></div><div class=""><font face="monospace, monospace" class=""> (require/typed (submod ".." data-defn) [#:struct foo ()])</font></div><div class=""><font face="monospace, monospace" class=""> (: foo->string (-> foo String))</font></div><div class=""><font face="monospace, monospace" class=""> (define (foo->string f) "foo"))</font></div><div class=""><font face="monospace, monospace" class=""><br class=""></font></div><div class=""><font face="monospace, monospace" class="">(module main typed/racket/base</font></div><div class=""><font face="monospace, monospace" class=""> (require/typed (submod ".." data-defn) [#:struct foo ()])</font></div><div class=""><font face="monospace, monospace" class=""> (require (submod ".." utils))</font></div><div class=""><font face="monospace, monospace" class=""> (: main (-> Void))</font></div><div class=""><font face="monospace, monospace" class=""> (define (main)</font></div><div class=""><font face="monospace, monospace" class=""> (displayln (foo->string (foo)))))</font></div><div class=""><br class=""></div><div class=""><div class=""><font face="monospace, monospace" class="">;; Type Checker: type mismatch</font></div><div class=""><font face="monospace, monospace" class="">;; expected: foo</font></div><div class=""><font face="monospace, monospace" class="">;; given: foo</font></div><div class=""><font face="monospace, monospace" class="">;; in: (foo)</font></div></div><div class=""><br class=""></div><div class=""><br class=""></div></div></div>
____________________<br class=""> Racket Users list:<br class=""> <a href="http://lists.racket-lang.org/users" class="">http://lists.racket-lang.org/users</a><br class=""></div></blockquote></div><br class=""></body></html>