Finish the hi-haddock story #1566
Description
Today, Haddock relies on the GHC API to re-typecheck modules for which it is generating documentation. This both increases the surface area of the GHC-Haddock interface and leads to unnecessarily long compilation times. Historically this was necessary because GHC had no means of persisting Haddock documentation in its build artifacts.
In 2018 we started down the road of preserving docstrings in GHC's interface files (see the GSoC proposal). The GHC side of this resulted in two commits (one in 2018 and another in 2021) which together introduce the necessary fields into GHC's interface file syntax along with necessary parsing logic, and implement a :doc
command to GHCi. During the course of this work Haddock was minimally updated (e.g. see 0280391) to track the changes made in GHC. However, there is a larger refactoring that still needs to be done...
Specifically, Haddock should be refactored to drop its typechecking logic and instead load the already-compiled interface files of the modules being documented from disk.