[Haskell-cafe] install haddock only with cabal?

Evan Laforge qdunkan at gmail.com
Sat Jul 1 15:10:38 UTC 2017

It's pretty common to wind up with a package installed, but not its
haddock.  Pretty much any time you install the traditional way via
runhaskell Setup.hs you can forget to run haddock, since it doesn't
use ~/.cabal/config.  And even if you do, it doesn't update the
haddock html index.

But it seems like cabal install wants to install all targets in the
cabal file, which means it wants to reinstall, which is no good for
e.g. 'stm'.  In fact I can't tell any way to address individual
targets (e.g. if I just want to install the executable), and haddock
doesn't seem to be a proper target at all, and I can't find any
documentation about it.  I can run 'haddock' and manually copy
dist/doc/html to ~/.cabal/share/doc/$arch/$package/, but shouldn't
cabal be able to do that?

Also, it looks like regenerateHaddockIndex is hardcoded into the
postInstallActions, and there's no way to run it independently, so it
seems if you missed documentation on some package, you have to
reinstall everything from scratch to fix it.

Is there a way to install just haddock without going through all that?

And shouldn't cabal-install/bootstrap.sh make the haddock index?
Otherwise, you're guaranteed to be missing links for a bunch of
fundamental packages.  Or maybe it could default to using its
(undocumented?) --sandbox flag to install just the binary, and not the
various libraries (which are also likely to be missing desired flags,
like --enable-profiling, since ~/.cabal/config is not available yet).

More information about the Haskell-Cafe mailing list