Skip to content

Don't store a GlobalRdrEnv in `mi_globals` for GHCi.

Zubin requested to merge wip/no-mi-globals into master

GHCi only needs the mi_globals field for modules imported with :module +*SomeModule.

It uses this field to make the top level environment in SomeModule available to the repl.

By default, only the first target in the command line parameters is "star" loaded into GHCi. Other modules have to be manually "star" loaded into the repl.

Storing the top level GlobalRdrEnv for each module is very wasteful, especially given that we will most likely never need most of these environments.

Instead we store only the information needed to reconstruct the top level environment in a module, which is the IfaceTopEnv data structure, consisting of all import statements as well as all top level symbols defined in the module (not taking export lists into account)

When a particular module is "star-loaded" into GHCi (as the first commandline target, or via an explicit :module +*SomeModule, we reconstruct the top level environment on demand using the IfaceTopEnv.

Merge request reports