Reduce HscEnv in GHC.Linker.Loader (#17957)
(Commit message copy-paste)
This converts (most) uses of HscEnv in Linker.Loader into uses of specific capabilities typically bundled into HscEnv, making demands of Loader functions explicit and reducing their dependency on the rest of (hard-to-construct) HscEnv.
The 6 HscEnv-using functions left all ultimately use getLinkDeps
, which needs HscEnv to run loadInterface
, a TcRnIf monad action. Not that Linker should run TcRnIf, but pulling loadInterface
out of TcRn, or cleaving a non-TcRn fragment of it to use in Linker is a refactoring for another day.