I'm writing a module that adds types to identifiers imported from untyped code, and I want to avoid contract generation. I see two approaches:
Using typed/racket/unsafe:
(require typed/racket/unsafe)
Using typed/racket/optional with renamed imports:
(require (rename-in typed/racket/base/optional
[require/typed unsafe-require/typed]
[provide unsafe-provide]
[require/typed/provide unsafe-require/typed/provide]
[cast unsafe-cast]))
My goal: Type bindings from untyped modules, trusting that the values already match their types.
Both approaches seem to bypass contract generation. But I'm unsure about their exact differences. Could someone clarify:
-
Are these approaches interchangeable, or do they have meaningful technical differences?
-
When should each be preferred?
I'd appreciate any insights about these mechanisms or pointers to relevant documentation. Thanks!