Today I've found a way to cabal-install offline documentation – with source hyperlinks! – for a Haskell package.

(The reddit link was quite helpful by pushing me in right direction.)

To obtain documentation without source hyperlinks you just

run `cabal install' with `--enable-documentation' option ...or

enable `documentation' parameter in ~/.cabal/config

Then reinstall the package with `cabal install --reinstall' command. Documentation will appear in ~/.cabal/share/doc/PACKAGE-VERSION/html/ directory.

But if you want proper documentation – with `Source' links to the right of declarations – try these commands (replacing `iteratee' with your favourite package):

$ cd /tmp $ tar -xzf ~/.cabal/packages/hackage.haskell.org/iteratee/0.2.4/iteratee-0.2.4.tar.gz $ cd iteratee-0.2.4 $ cabal configure $ cabal haddock --hyperlink-source ## NOTE: ## * Make sure `documentation' is *disabled* in ~/.cabal/config. ## * Don't use `--enable-documentation' in `cabal install' command. ## Otherwise links to source code will be omitted from documentation. $ cabal install --reinstall

That's almost it. But source code pages will not be syntax-highlighted, because hscolour.css is missing. I've used a workaround:

$ cd ~/.cabal/share/doc/iteratee-0.2.4/html/src $ ln -s /usr/share/doc/ghc6-doc/libraries/Cabal/src/hscolour.css

Now everything is sweet (i.e., documented and hyperlinked to sources).

This post is a reminder to myself, which may possibly help some other haskeller.

SEE ALSO