With the release of hoogle5, we can now hoogle all local packages.
This let us implement stack hoogle
, which is on the master
branch of stack, but is not yet on a stack release. We'd like you to
try it out before we do!
To upgrade to the latest stack from git, use:
$ stack upgrade --git
Or just run stack install
in your local copy of the stack repo, if
you have one.
Now, in any stack project, run:
$ stack hoogle map
After a bunch of setup work (see below), you'll get something like
bash-3.2$ stack hoogle map
map :: (a -> b) -> [a] -> [b]
map :: (Word8 -> Word8) -> ByteString -> ByteString
[..]
Pass -i
to show documentation:
bash-3.2$ stack hoogle -- -i map
map :: (a -> b) -> [a] -> [b]
base Prelude
map f xs is the list obtained by applying f
to each element of xs, i.e.,
map f [x1, x2, ..., xn] == [f x1, f x2, ..., f xn]
map f [x1, x2, ...] == [f x1, f x2, ...]
Each project has its own installation of hoogle:
bash-3.2$ stack exec which hoogle
/Users/chris/Work/hs-popen/.stack-work/install/x86_64-osx/lts-5.3/7.10.3/bin/hoogle
Unless you install it globally, in which case it'll use the one in
your PATH if it's >=5.0. So if you get sick of it installing copies of
hoogle, do stack install hoogle-5.0
.
Please give it a try!
Hoogle5 is probably not installed on your system, so you'll see this message:
Hoogle isn't installed or is too old. Automatically installing (use --no-setup to disable) ...
Minimum version is hoogle-5.0. Found acceptable hoogle-5.0 in your index, installing it.
After installing Hoogle5 it'll say:
No Hoogle database yet. Automatically building haddocks and hoogle database (use --no-setup to disable) ...
Then it'll run stack haddock
and then stack hoogle -- generate --local
.
If you see a message like
Packages not found: abstract-par aeson aeson-compat [..]
Don't worry about it; stack only generates haddocks for the things you're using in your project, whereas hoogle is looking at everything in the snapshot database.
Relatedly, if you add a dependency to your project, run stack hoogle --rebuild
, and that'll generate the haddocks and the hoogle database
again.
any chance this is integrated with Intero?