Question

I'm using GHC and have installed several packages via Cabal. One of the packages' web site says "go see the haddock documentation". The haddock command seems to only work on source files, and cabal haddock only seems to work in the top-level directory of a project with a .cabal build file. Is there a way to say "show me the haddock" for a module?

I'm longing for pydoc -p 12345 which starts an HTTP server providing Python documentation based on what you have installed locally.

As a work-around, I extracted the source tarball from under ~/.cabal and ran cabal configure; cabal haddock in the source directory, but that's kind of a pain.

Was it helpful?

Solution

edit your config file:

~/.cabal/config

there is a option to enable default install doc:

documentation: True

to install doc of existing packages, use:

cabal install xxx --reinstall

re-install docs from basic packages then the upper-level packages, so the "hyper-link" to other modules will be generated properly.

OTHER TIPS

The --haddock flag didn’t work for me. However, replacing --haddock with --enable-documentation did:

cabal install $project --enable-documentation

Now, if they could allow the --hyperlink-source flag to zip through to haddock I’d be very happy.

This is a known issue. As a workaround you can configure your Apache installation (if you have one) to serve your doc directory using this small PHP script.

You should be able to generate local documentation with:

cabal install $project --haddock

Assuming you have Haddock installed.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top