I installed hoogle, using stack install hoogle. Now I can search for functions using a command like this from stack ghci:
:!hoogle --count=15 "[a] -> a"
I am in the root directory of my Yesod project - the main reason I installed it was to get help with Yesod functions - but when I try to find a function from Yesod like addHeader, it doesn't recognize a type defined on Yesod:
:t addHeader
addHeader :: MonadHandler m => Text -> Text -> m ()
:!hoogle --count=15 "MonadHandler m => Text -> Text -> m ()"
Warning: Unknown class MonadHandler
.
.
.
How can I setup hoogle to work beautifully with Yesod and also this very project I am working on, so that hoogle would bring my own functions and Yesod ones?
You'll need to first get Hoogle to create you a yesod-core database:
Then it just works!
Yuck, the
+yesod-coretag isn't great. Fortunately, we can combine our Hoogle databases into one big one:(Your databases path will vary depending on whether you
stack installed orcabal installed.)Way better than Google.