Excellent! I can't do that in this exact situation (every module counts right now), but in the future that's exactly what I want. Thank you.
On Fri, Feb 6, 2015 at 12:15 AM, Alexis King <lexi.lam...@gmail.com> wrote: > Why not create an intermediary module? Create a typed module, call it > typed/data-defn, and use require/typed/provide 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. > > On Feb 5, 2015, at 21:10, Benjamin Greenman <bl...@cornell.edu> wrote: > > I've got three modules: > - One untyped module defines some structs > - One typed module defines some helper functions > - One typed module does some interesting things > > I've also got a problem: I cannot share imported untyped structs between > the typed modules. > > 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). > > Here's the minimal example. Can we at least make the error message more > helpful? > > #lang racket/base > > (module data-defn racket/base > (provide (struct-out foo)) > (struct foo ())) > > (module utils typed/racket/base > (provide foo->string) > (require/typed (submod ".." data-defn) [#:struct foo ()]) > (: foo->string (-> foo String)) > (define (foo->string f) "foo")) > > (module main typed/racket/base > (require/typed (submod ".." data-defn) [#:struct foo ()]) > (require (submod ".." utils)) > (: main (-> Void)) > (define (main) > (displayln (foo->string (foo))))) > > ;; Type Checker: type mismatch > ;; expected: foo > ;; given: foo > ;; in: (foo) > > > ____________________ > Racket Users list: > http://lists.racket-lang.org/users > > >
____________________ Racket Users list: http://lists.racket-lang.org/users