plait
plait copied to clipboard
requiring #:untyped modules into plait modules
The following works fine if I replace #lang plait with #lang racket or #lang plait #:untyped
#lang plait
(module sub plait
#:untyped
(define (foo x) x))
(require (submod "." sub))
(foo 2)
The scenario is the same as in #5; it would be a bit cleaner if the top level module was plait. On the other hand this one is easy to work around. I'm also a bit confused why I can't write (require 'sub) in the #lang plait #:untyped case.
The root problem here is that (require (submod "." sub)) doesn't give foo a type. I've changed require so that it complains about (submod "." sub) being an untyped module, instead of silently importing nothing.
As you may already realize, you can give the imported foo a type with
(require (typed-in (submod "." sub)
[foo : (Number -> Number)]))
That makes sense. I think the (main) issue can be closed with the added error message.
The other minor issue is that using a symbol in a submodule path works in plait but not in #:untyped. If you think that's worth tracking I can make a separate issue.
Ironically I now realize that I can't use a top level plait module precisely for the reason I wanted an #:untyped submodule in the first place: the original function in question (before the example was minimized) can't be typed in plait (needs a union type).