Add Hoogle command to the REPL

After installing the hoogle command line tool, add this lines to your .ghci file:

:def hoogle \x -> return $ ":!hoogle \"" ++ x ++ "\""
:def doc    \x -> return $ ":!hoogle --info \"" ++ x ++ "\""


  • open the haskell repl: stack repl
  • call the hoogle command using the following instruction: :hoogle [any query]
  • or :doc [any query]

Got an error with “” while building with stack

If you hit with the message:

can't load .so/.DLL for: ( cannot open shared object file: No such file or directory)

running stack install or stack build, install the package “ncurses-devel” on fedora or “libtinfo-dev” on debian.

Install hoogle command line tool

$ stack install hoogle
$ hoogle generate


hoogle [COMMAND] ... [OPTIONS]

  [search]  Perform a search
  gerenate  Generate Hoogle databases
  server    Start a Hoogle server
  replay    Replay a log file
  test      Run the test suite

Common flags:
  -? --help             Display help message
  -V --version          Print version information
     --numeric-version  Print just the version number
  -v --verbose          Loud verbosity
  -q --quiet            Quiet verbosity

Import modules on ghci

-- import
:m +Name.Of.Module

-- unimport
:m -Name.Of.Module

-- :m is a shortcut for :module

Making small executables?

$ ghc -o hello hello.hs
$ strip -p --strip-unneeded --remove-section=.comment -o hello-small hello
$ du hello hello-small
700 hello
476 hello-small

Multiline mode in ghci

-- set
:set +m

-- unset
:unset +m