Skip to content

Add `-fignore-export-list` flag for use in GHCi

Currently GHCi uses the mi_globals field of ModIface to provide the following features:

  1. Non exported names are visible and can be used from the repl
  2. The import environment of loaded modules is replicated in the repl, so that if you import M in a file and then load the file in GHCi, symbols from M will be available in the repl

Unfortunately using mi_globals for this can leak a lot of memory: #22832 (closed)

Instead I propose to introduce a new flag -fignore-export-list that makes GHC behave as if the export list isn't present while compiling a module. This can be used by GHCi to provide feature 1.

For feature 2 I propose that we have special logic in GHCi to contruct an RdrEnv from the header of the currently loaded module(s).

This way, we can avoid keeping mi_globals around for all the modules in a big GHCi session with a lot of files, and instead only construct the RdrEnv for a module that is :loaded into the repl, from its header, avoiding keeping the RdrEnv around for its transitive dependencies.

Edited by Zubin
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information