@hsyl20 and, more recently, @doyougnu have done excellent work untangling GHC, in particular banishing DynFlags
and HscEnv
from as many modules as possible. Many of the refactors are quite hard, not because they are necessarily technically advanced, but because GHC is a labyrinth that would make Thesus blush, and so breaking down this task into manageable chunks requires great wisdom and patience.
However, once the plan is made, executing on it isn’t always so hard. I just stumbled upon a module at random and did GHC.HsToCore.Coverage: No more HscEnv, less DynFlags (!7467) · Merge requests · Glasgow Haskell Compiler / GHC · GitLab, which I’d say is an exceptionally unimpressive patch:). It is 100% rote “cinching upstream” projection from DynFlags
and HscEnv
, whenever it is easy to do so, in just one module. Now it may not always be this easy, but if I just stumbled into this, I bet there is a few more cases like it!
I know @hsyl20 is doing some writing to better explain what’s going on, and I don’t want to upstage that / his own planning more broadly. But due to the interest in https://github.com/haskellfoundation/tech-proposals/pull/24 and Pre-HFTP: Coordination for finishing Trees That Grow, I thought it would be good to mention this as the 3rd such major “Cleanup GHC incrementally” task I can think of.