Build local Hoogle DB despite error in Haddock

442 Views Asked by At

Is there a workaround to build a lokal Hoogle DB despite Haddock errors in some packages. For example, is there a workaround on how to exclude those packages from the Haddock sub-task during the lokal Hoogle DB build?

As a concret example:

$ stack hoogle
No Hoogle database yet. Automatically building haddocks and hoogle database (use --no-setup to disable) ...
classy-prelude-yesod-1.5.0: configure
classy-prelude-yesod-1.5.0: build
classy-prelude-yesod-1.5.0: haddock
Progress 1/2

--  While building package classy-prelude-yesod-1.5.0 using:
      /Users/nrm/.stack/setup-exe-cache/x86_64-osx/Cabal-simple_mPHDZzAJ_2.4.0.1_ghc-8.6.4 --builddir=.stack-work/dist/x86_64-osx/Cabal-2.4.0.1 haddock --html --hoogle --html-location=../$pkg-$version/ --haddock-option=--hyperlinked-source --haddock-option=--quickjump
    Process exited with code: ExitFailure 1
    Logs have been written to: /Users/nrm/Sources/mdpm/projects/Yapper/.stack-work/logs/classy-prelude-yesod-1.5.0.log

    Configuring classy-prelude-yesod-1.5.0...
    Preprocessing library for classy-prelude-yesod-1.5.0..
    Building library for classy-prelude-yesod-1.5.0..
    [1 of 2] Compiling ClassyPrelude.Yesod ( src/ClassyPrelude/Yesod.hs, .stack-work/dist/x86_64-osx/Cabal-2.4.0.1/build/ClassyPrelude/Yesod.o )
    [2 of 2] Compiling Paths_classy_prelude_yesod ( .stack-work/dist/x86_64-osx/Cabal-2.4.0.1/build/autogen/Paths_classy_prelude_yesod.hs, .stack-work/dist/x86_64-osx/Cabal-2.4.0.1/build/Paths_classy_prelude_yesod.o )
    Preprocessing library for classy-prelude-yesod-1.5.0..
    Running Haddock on library for classy-prelude-yesod-1.5.0..
    Haddock coverage:
    haddock: internal error: internal: extractDecl
    CallStack (from HasCallStack):
      error, called at utils/haddock/haddock-api/src/Haddock/Interface/Create.hs:1116:12 in main:Haddock.Interface.Create

Relates to How to build with haddocks, but ignore haddock errors

1

There are 1 best solutions below

2
On

stack hoogle is approximately a helper around stack haddock then hoogle generate --local. If you can generate Haddock output only for the projects that work then you can manually hoogle generate --local. However, I'm not aware of any way to restrict stack haddock to only a subset, so it may not be practical.

Another approach is to hoogle generate <list of dependencies>, which will use the remote documentation rather than local, and thus will skip running Haddock.