Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Manage hoogle index using stack tool

Context: Before stack I stopped using hoogle locally because my index would somehow lose sync with installed packages. If I recall correctly, I had issues with different results in ghci, command line and cabal sandboxes.

Can I leverage stack environment manage my local hoogle databases?

like image 943
sevo Avatar asked Jan 06 '16 16:01

sevo


1 Answers

For the Hoogle part I recommend using the latest git version, which will become version 5. To install that, do:

git clone https://github.com/ndmitchell/hoogle.git
cd hoogle
stack init
stack install

Then generate it and use it with:

# generate Haddock docs for all your packages
stack haddock
# generate the Hoogle index
stack exec -- hoogle generate --local --database=.stack-work/hoogle
# perform a search for map
stack exec -- hoogle map --database=.stack-work/hoogle
# start a server at http://127.0.0.1/ to browse docs
stack exec -- hoogle server --local --database=.stack-work/hoogle

To make this work with Cabal instead of Stack, do cabal install initially, set your haddock/hoogle preference in your Cabal config file to True, and remove the stack exec bits.

like image 132
Neil Mitchell Avatar answered Oct 20 '22 23:10

Neil Mitchell