I've installed hoogle locally and have run hoogle generate.
If I run hoogle maybeToEither I get:
Data.Either.Utils maybeToEither :: MonadError e m => e -> Maybe a -> m a Either maybeToEither :: Monoid b => (a -> b) -> Maybe a -> b Network.Haskoin.Util maybeToEither :: b -> Maybe a -> Either b a However if I use the web search I get a few more entries:
Is there a way I can generate the same 'database' locally? Or is there possibly a CLI for searching ?
According to I should be able to run hoogle data or hoogle data all - but this seems do just do a search (so maybe outdated?).
2 Answers
I tried:
$ cabal update $ cabal install hoogle Installed hoogle-5.0.17.2 $ hoogle generate --download $ hoogle maybeToEither And got the response:
Data.Either.Utils maybeToEither :: MonadError e m => e -> Maybe a -> m a Data.Either.Extra maybeToEither :: a -> Maybe b -> Either a b Extra maybeToEither :: a -> Maybe b -> Either a b Protolude.Either maybeToEither :: e -> Maybe a -> Either e a Agda.Utils.Either maybeToEither :: Maybe a -> Either () a Intro maybeToEither :: () => a -> Maybe b -> Either a b At the moment the web shows 6 entries, because it has merged the Data.Either.Extra and Extra entries into one line as they refer to the same definition. Other than that, they match.
Note that hoogle generate generates a database based on what you have already downloaded, so if you run hoogle generate every month the result will not change. Adding --download forces Hoogle to download afresh.
This project might be of interest:
I've also written bash function (depends on jq, fzf, xclip):
hoogle_searchAndCopy() { wget -qO- "$1"\&scope\=set%3Astackage\&mode\=json \ | jq -r ".[] | \"import \\(.module.name)\\n\\(.package.name)\\n--\"" \ | fzf | xclip ; } hoogle_searchAndCopy maybeToEither results in:
