RFC: TcRnExports remembers `AvailInfo` for each IE with -haddock
AbandonedPublic

Authored by alexbiehl on Aug 13 2017, 7:31 AM.

Details

Summary

This patch removes then need for haddock to reimplement the calculation of exported names from modules. Instead when renaming export lists ghc annotates each IE with its exported names.

Haddocks current export logic has caused lots of trouble in the past (on the Github issue tracker):

This is obiously the simplest possible way to achieve this. Another way would be to export functions like lookupAvails :: GlobalRdrEnv -> IE Name -> [Name] but this would require a major refactoring in GHC.

alexbiehl created this revision.Aug 13 2017, 7:31 AM
alexbiehl edited the summary of this revision. (Show Details)Aug 13 2017, 7:32 AM
alexbiehl added a reviewer: ezyang.

I feel like this commit could be made more type-safe, since there seems to be some implicit invariant on how IEAvails is supposed to be inserted in IEs. I'm sympathetic to the desire to avoid API breaking changes but I think doing it properly is it worth it here.

compiler/hsSyn/HsImpExp.hs
219

I am a little perplexed: is it the case that an IE is ALWAYS wrapped exactly once in IEAvails? Can there be (IEAvails (IEAvails (IEAvails ...)))?

alexbiehl added a comment.EditedAug 13 2017, 11:21 AM

@ezyang yes, you are right. Take this diff as a starter for discussion. Do you have a better idea?

alexbiehl abandoned this revision.Aug 25 2017, 1:44 AM