Skip to content

Instantly share code, notes, and snippets.

@blitzcode
Last active September 10, 2023 17:39
Show Gist options
  • Save blitzcode/8123168 to your computer and use it in GitHub Desktop.
Save blitzcode/8123168 to your computer and use it in GitHub Desktop.
Haskell Hoogle Local Version Setup Steps
# Install a local copy of Hoogle (OS X 10.10, GHC 7.10.1)
# Download
cd
cabal unpack hoogle
cd hoogle-4.2.40/
# Use a sandbox
cabal sandbox init
# We need haskell-src-exts and it needs happy to be installed somewhere, can probably skip this step when using the HP
cabal install happy
export PATH=.cabal-sandbox/bin/:$PATH
# Build
cabal install -j --dependencies-only
cabal build
cabal install
# Link it somewhere in the path
cd ~/Library/Haskell/bin/
rm hoogle
ln -s ~/hoogle-4.2.40/dist/build/Hoogle/hoogle hoogle
# Hoogle's data command needs a newer wget than what OS X 10.10 ships, install a new one with homebrew and add it to the path
brew install wget
export PATH=/usr/local/Cellar/wget/1.15_1/bin/:$PATH
# Download everything from Hackage
# Can use use '-j <num_threads>' to speed up (seems to cause errors with 4.2.33, though)
hoogle data all
# TODO: Figure out how to use '--local[=FILEPATH]' to use local copies of haddock documentation
# Build a better default.hoo (optional)
# Start by combining databases for base/platform/selected hackage
cd ~/hoogle-4.2.40/.cabal-sandbox/share/x86_64-osx-ghc-7.10.1/hoogle-4.2.40/databases/
# All of base
hoogle combine --outfile=all_of_base.hoo Cabal.hoo array.hoo base.hoo binary.hoo bytestring.hoo containers.hoo deepseq.hoo directory.hoo filepath.hoo haskell2010.hoo haskell98.hoo hoopl.hoo hpc.hoo old-locale.hoo old-time.hoo pretty.hoo process.hoo template-haskell.hoo time.hoo unix.hoo
# All of the Haskell Platform 2013.2.0.0
hoogle combine --outfile=all_of_hp.hoo GLURaw.hoo GLUT.hoo HTTP.hoo HUnit.hoo OpenGL.hoo OpenGLRaw.hoo QuickCheck.hoo async.hoo attoparsec.hoo case-insensitive.hoo cgi.hoo fgl.hoo hashable.hoo haskell-src.hoo html.hoo mtl.hoo network.hoo parallel.hoo parsec.hoo primitive.hoo random.hoo regex-base.hoo regex-compat.hoo regex-posix.hoo split.hoo stm.hoo syb.hoo text.hoo transformers.hoo unordered-containers.hoo vector.hoo xhtml.hoo zlib.hoo
# Stuff I use the most from Hackage
hoogle combine --outfile=selected_hackage.hoo GLFW-b.hoo JuicyPixels.hoo MonadCatchIO-transformers.hoo SafeSemaphore.hoo aeson.hoo ansi-terminal.hoo authenticate-oauth.hoo binary.hoo bindings-GLFW.hoo blaze-builder.hoo bmp.hoo conduit.hoo data-default.hoo dlist.hoo ekg.hoo hashtables.hoo http-attoparsec.hoo http-conduit.hoo http-types.hoo wai.hoo http-client.hoo lifted-base.hoo mmorph.hoo monad-control.hoo network-conduit.hoo conduit-combinators.hoo conduit-extra.hoo repa.hoo repa-algorithms.hoo repa-io.hoo resourcet.hoo th-lift.hoo tls.hoo linear.hoo lens.hoo criterion.hoo vector-algorithms.hoo monad-loops.hoo loop.hoo safe.hoo either.hoo transformers-base.hoo
# Combine all previous database into the default.hoo, also add database for package names and keywords
hoogle combine --outfile=default.hoo all_of_base.hoo all_of_hp.hoo selected_hackage.hoo package.hoo keyword.hoo
# Start webserver (need root to bind to port <1024)
# I use port 81 because my /etc/hosts redirects some stuff to 127.0.0.1, and I don't want those going to hoogle
sudo hoogle server -p 81
# Extra tip for Firefox users: Right-click the Hoogle search box and chose 'Add a Keyword for this Search...', giving access to your local Hoogle by tiping something like 'h a -> a' into the address field
# TODO: Add detailed instruction on how to update the installation with the --redownload and --rebuild flags of the 'data' command
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment