how to build Haddock documentation for a single module?

Norman Ramsey nr at cs.tufts.edu
Thu Apr 14 19:30:33 UTC 2022


 > Is there a way I can get Hadrian to build the documentation for
 > just that module?

Here's more detail about what I'm facing.  I'm trying to fine-tune the
Haddock documentation of a module that I intend to put into an MR for
GHC Central.  This means I need to be able to re-run Haddock so I can
look at the output, with a sensible turnaround time.


I've tried

```
./hadrian/build _build/docs/html/libraries/ghc/GHC-Driver-Backend.html
```

But this attempt results in no action, even when the source code has
changed.

I've also tried 

```
haddock -o /tmp/zzz -h compiler/GHC/Driver/Backend.hs
```

But this attempt results in a slew of error messages, all similar, of
which a representative sample looks like this:

```
compiler/GHC/Driver/Backend.hs:104:1: error:
    Could not load module ‘GHC.Prelude’
    It is a member of the hidden package ‘ghc-9.2.2’.
    You can run ‘:set -package ghc’ to expose it.
    (Note: this unloads all the modules in the current scope.)
    Use -v (or `:set -v` in ghci) to see a list of the files searched for.
    |
104 | import GHC.Prelude
    | ^^^^^^^^^^^^^^^^^^
```

Finally, I have had some success with

```
./hadrian/build -j _build/docs/html/index.html
```

This attempt does rebuild the documentation, but I am sorry to say
that the first run took 19 minutes, and subsequent runs take about
3 minutes.  On a nice, beefy machine with 8 cores.  If it takes
3 minutes to visualize every change in the documentation, I think I
will not have the patience to make any more changes.

Help?


Norman


More information about the ghc-devs mailing list