local Haddock and Hoogle with Stack

If you used Haskell for some time you probably have seen Hoogle and used the Haddock Documentations before. But what if you want to take those with you (say you have no WiFi)?

I like to install both things locally and stack is a really nice and quick way to do it.


The steps to setup up local (offline) Haddock and Hoogle using stack is quite simple.

I like to do this from a project folder I’m working on right now

stack build --haddock-deps
stack hoogle

the first one should download/build all the missing documentation and the second one should build and setup a local hoogle instance for your project.

After you can just use stack hoogle -- "[a] -> a" from your terminal to search or start the server using stack hoogle server.

using hoogle server and your browser

The running server – remember: stack hoogle server – (usually on localhost:8080) will automatically link to the local documentation files but if you are using chrome you will most likely not be able to follow the links, as chrome blocks links to local content.

I use the LocalLinks plugin to circumvent this security measure.