ModuleInfo.minf_rdr_env not exposed

Sam Halliday sam.halliday at
Tue Aug 6 19:52:37 UTC 2019


I would like to submit a patch to ghc 8.8 adding a function that exposes a field that is useful for tooling authors and can already be reached, albeit in a very awkward way.

The process documented at
seems very heavyweight for the patch that I was planning to propose,
which is just adding the following to GHC.hs (and exporting it):

  modInfoRdrEnv :: ModuleInfo -> Maybe GlobalRdrEnv
  modInfoRdrEnv = minf_rdr_env

Without this accessor, we must reparse and typecheck the file to get the GlobalRdrElts, which is very inefficient and uses fields named "internal" so I'm guessing that's not a good thing to build a tool on top of.

My colleague already wrote a tool using a workaround, see

How should I go about submitting this? Do I need to write a test or is this trivial enough not to bother?

Sam Halliday <sam.halliday at> writes:

> Hi all,
> Is there a reason why minf_rdr_env (a field in ModuleInfo) is not
> exposed?
> It's possible to reconstruct it in 8.4.4 (the only version I'm looking
> at) with a TypecheckedModule via
>   let (tc_gbl_env, _) = GHC.tm_internals_ tmod
>       minf_rdr_env = tcg_rdr_env tc_gbl_env
> It's a useful thing to have for editor tooling (e.g. to get the correct
> qualified imported symbols that may be autocompleted).
> -- 
> Best regards,
> Sam

Best regards,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 194 bytes
Desc: not available
URL: <>

More information about the ghc-devs mailing list