Skip to content
This repository has been archived by the owner on Aug 3, 2024. It is now read-only.

Finish the hi-haddock story #1566

Open
bgamari opened this issue Jan 9, 2023 · 4 comments
Open

Finish the hi-haddock story #1566

bgamari opened this issue Jan 9, 2023 · 4 comments

Comments

@bgamari
Copy link
Collaborator

bgamari commented Jan 9, 2023

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.

@Kleidukos
Copy link
Member

Okay, thank you very much for this recap. From what I understand, this commit (https://gitlab.haskell.org/ghc/haddock/-/commit/dfab819b24eec31c00a4ffc6a64516acbb0a8216) by @harpocrates would be the missing piece?

@harpocrates Would you like to pair with me sometime so that we can bring this to the finish line? :)

@bgamari
Copy link
Collaborator Author

bgamari commented Jan 9, 2023

@Kleidukos, that is correct.

@Kleidukos
Copy link
Member

Kleidukos commented Jan 10, 2023

@bgamari I think I'm on the verge of making things compile, however the patch was written prior to changes that happened in GHC 9.4.
Especially, I need to get a [ClsInst] to feed createInterface1. However this commit replaces the type of md_insts from [ClsInst] (what I seem to need) to InstEnv through mkInstEnv.

This is a territory in which I am everything but familiar, and some direction would be appreciated.

Here is the current state of the PR: #1571

@bgamari
Copy link
Collaborator Author

bgamari commented Jan 10, 2023

@Kleidukos perhaps GHC.Core.InstEnv.instEnvElts helps?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants