Skip to content

Hi Haddock 2021 - Generate docs from .hi files

Zubin requested to merge wip/hi-haddock2021 into master

This is a rebased and improved version of @harpocrates rebase of @sjakobi's original patch

See also !608 (closed)

Major differences from that patch include

  • We now properly attribute docs for default method signatures, which required quite a bit of plumbing
  • Identifiers in documentation strings are just acculated in a NameSet, haddock then picks appropriate names for the identifiers from this set, with the correct name space. We don't map individual substrings of the docstring corresponding to the list of possible Names anymore, since this is fragile and unnecessary, as the naming environment is the same for the entire docstring. This in turn means that HsDocIdentifierSpan is unnecessary since neither GHC nor Haddock use it for anything. It might be good to delete it entirely, but other tooling might like to know where exactly in the docstring certain names occur so I'm not sure. The logic to compute HsDocIdentifierSpan in HaddockLex is quite tricky, so I'm leaning towards removing it.
  • Haddock no longer uses a plugin since we don't need access to the parsed module.
  • Various other minor improvements and bug fixes
Edited by Matthew Pickering

Merge request reports