hoogle-index — Painless local Haddock indexing
hoogle-index is a small utility for generating indicies for local
$ cabal install hoogle hoogle-index $ hoogle-index -i -l # this will take a couple of minutes $ hoogle server -l -p 9000 $ firefox http://localhost:9000/
Your Hoogle index now covers all of the packages locally installed.
What it does
First the utility identifies what packages have been installed. We traverse these packages in topological order to ensure that Hoogle can resolve as many references as possible.
For each package, the utility first checks the package's documentation
for an existing textbase (a textual description of a package's interface
haddock). While these are provided with some packages
(e.g. those installed with GHC), in most cases we'll need to generate
one. To do this we unpack the package source, configure it, and invoke
Haddock. To avoid needing regenerate this file in future runs we also
install the resulting textbase in the appropriate spot in
With a textbase in hand we can convert this to a Hoogle database. After traversing all installed packages these individual databases are merged.
hoogle-index has basic support for cabal sandboxes. Simply run
within the root directory of your sandbox and invoke
hoogle subcommand. For instance,
$ mkdir test $ cabal sandbox init $ cabal install acme-missiles $ hoogle-index -l $ hoogle-index hoogle launchMissiles Acme.Missiles launchMissiles :: IO () Acme.Missiles.STM launchMissilesSTM :: STM ()
At the moment
hoogle-index is an unholy combination of using the
library directly and invoking the
cabal-install binary. This means that
things will break if any of the following conditions do not hold,
cabal-installis compiled against the same
cabal -Vwill report the version that
cabal-installis built against)
haddockis compiled against the GHC version currently in use
Moreover, some older
hoogle releases will fail with some Haskell extensions.
This has been fixed upstream.