A long-standing issue with Haskell’s documentation tool Haddock is that it needs to effectively re-perform a large part of the parse/template-haskell/typecheck compilation pipeline in order to extract the necessary information from Haskell source for generating rendered Haddock documentation. This makes Haddock generation a costly operation, and makes for a poor developer experience.

An equally long-standing suggestion to address this issue is to have GHC include enough information in the generated .hi interface files in order to avoid Haddock having to duplicate that work. This would pave the way for following use-cases and/or have the following benefits:

1) Significantly speed up Haddock generation by avoiding redundant work.

2) On-the-fly/lazy after-the-fact Haddock generation in cabal new-haddock and stack haddock for already built/installed Cabal library packages.

3) Add native support for a :doc command in GHCi’s REPL and editor tooling (ghc-mod/HIE) similar to the one available in other languages (c.f. the Idris REPL or the Python REPL)

4) Allow downstream tooling like Hoogle or Hayoo! to index documentation right from interface files.

5) Simplify Haddock’s code base.



Simon Jakobi


  • Herbert Valerio Riedel
  • Alex Biehl