Description
Describe the feature request
When declaring reexported-modules
in a cabal file, it would be useful to communicate deprecation and relocation notices when that module is imported and only provided by that package.
Additional context
The idea was surfaced by @adamgundry in this comment about relocating the GHC.RTS.Flags
module. We want to move the module from base
to another package. If we only move the module, then users that depend on base
but not ghc-rts-flags
will face an unhelpful error message: "Module GHC.RTS.Flags
not found." If we re-export the module, then it's still part of the public API of base
. This means we can't offer a nice deprecation cycle with messaging on how to fix the resulting issue.
Let's imagine that we do this:
-- old-package.cabal
name: old-package
build-depends: new-package
reexported-modules:
new-package:MovedModule deprecated:"This module has been removed from old-package and will be available from new-package."
If someone imports MovedModule
and it comes from old-package
as a re-exported module, then we emit a warning at the import site. If they import MovedModule
and they depend on new-package
as well, then we don't need to issue the warning.