Search code examples
haskellhackage

How can I search a hackage package for a function?


Maybe I am missing something, but is there a way to search inside some package on hackage?

Let's say I know that Snap framework has a function called render. How do I find it starting on it's hackage page: http://hackage.haskell.org/package/snap-0.9.0.1


Solution

  • You can use Hoogle for this (as for so many other things) by using the +package search operator.

    By default, Hoogle will search inside a standard set of packages by name or by type:

    Now, that's fine and dandy, but what about other packages? If you search for render, you find Render :: RenderMode from OpenGL, render :: Doc -> String from pretty, and some other things; the snap package isn't searched by default.

    However, if you add +packagename or +Module.Name to your search, Hoogle will only search inside the specified packages (and -packagename and -Module.Name remove packages/modules from the search). Thus, searching for +snap render finds only the following three things:

    For more information on using Hoogle, you can check its manual on the Haskell wiki.