BSD-3-Clause licensed and maintained by Neil Mitchell
This version can be pinned in stack with:hoogle-4.2.41@sha256:1158fcd8a8af79314729646824f34586e3843152bc795343e44992e52cbf9056,5065

Module documentation for 4.2.41

Hoogle Hackage version Build Status

NOTE: This code branch contains the code for the Hoogle v4 series. The master branch contains the code for the current Hoogle v5 series.

Hoogle is a Haskell API search engine, which allows you to search many standard Haskell libraries by either function name, or by approximate type signature. To experiment, visit the online version at

Hoogle Use

Hoogle can be used in several ways:



Here are some example searches:

  • map searches as text, finding map, concatMap, mapM
  • con map searches for the text “map” and “con” finding concatMap, but not map
  • a -> a searches by type, finding id :: a -> a
  • a searches for the text “a”
  • :: a searches for the type “a”
  • id :: a -> a searches for the text “id” and the type “a -> a”


By default, searches look at the Haskell Platform and Haskell keywords. However, all Hackage packages are available to search. As some examples:

  • mode +cmdargs searches only the “cmdargs” package
  • file -base searches the Haskell Platform, excluding the “base” package
  • mode +platform +cmdargs searches both the Haskell Platform and the “cmdargs” package
  • count +missingh searches only the “MissingH” package - all packages are written in lower-case

With the set of packages you are searching, you can also restrict the set of modules searched:

  • file -System excludes results from modules such as System.IO, System.FilePath.Windows and Distribution.System
  • fold +Data.Map finds results in the Data.Map module


Command Line Version

To invoke Hoogle type:

hoogle "[a] -> [b]"

Note the quotes, otherwise you will redirect the output to the file [b].

To ensure you have data files for the Hackage modules, you will first need to type:

hoogle data

Which will download and build Hoogle databases.

Chrome Integration

As a keyword search: With a keyword search you can type h map directly into the location bar to perform a Hoogle search. Go to the Hoogle website in Chrome, right-click in the Hoogle search field and select “Add as a search engine…”. Give it a keyword such as “h”.

Firefox Integration

From the search bar: Go to the Hoogle website in Firefox and click on the drop-down arrow at the left of the search bar, and select the “Add Hoogle” option. Click the arrow again to select Hoogle as your search engine.

As a keyword search: With a keyword search you can type h map directly into the location bar to perform a Hoogle search. Go to the Hoogle website in Firefox, right-click in the Hoogle search field and select “Add a Keyword for this Search…”. Given it a keyword such as “h”.

If you want to search for special symbols in Firefox keyword search, modify the keyword search URL to be: javascript:window.location.href="" + encodeURIComponent("%s")

Firefox Ubiquity Integration

Ubiquity provides a graphical command-line for Firefox. To install the Ubiquity Hoogle command, visit the this page and click “Subscribe…” when asked whether you want to install it. Further information is available here.


Hoogle work is licensed under the GPL version 2.0. Any patches are assumed to be dual licensed under the BSD license and the GPL, to allow re-licensing Hoogle under the BSD license in future, if that proves beneficial to the Haskell community. The work is intended to be helpful, open and free. If the license doesn’t meet your needs then talk to me.

Theoretical Foundations

A lot of related work was done by Rittri [1] and Runciman [2] in the late 80’s. Since then Di Cosmo [3] has produced a book on type isomorphisms. Unfortunately the implementations that accompanied the earlier works were for functional languages that have since become less popular.

  1. Mikael Rittri, Using Types as Search Keys in Function Libraries. Proceedings of the fourth international conference on Functional Programming languages and Computer Architecture: 174-183, June 1989.
  2. Colin Runciman and Ian Toyn, Retrieving reusable software components by polymorphic type. Journal of Functional Programming 1 (2): 191-211, April 1991.
  3. Roberto Di Cosmo, Isomorphisms of types: from lambda-calculus to information retrieval and language design. Birkhauser, 1995. ISBN-0-8176-3763-X

I have given several presentations on type searching all available from my home page.


The folders in the distribution, and their meaning are:

data - tools to generate a hoogle data file docs - documentation on hoogle misc - presentations, icons, emacs scripts, logos src - source code web - additional resources for the web front end (css, jpg etc.)

Similar Tools

I was unaware of any similar tools before starting development, and no other tool has really influenced this tool (except the first on this list). Some related tools are:

  • Google, the leader in online search
  • Hayoo, similar to Hoogle, but with less focus on type search
  • Krugle, search code, but no Haskell :(


All code is all © Neil Mitchell, 2004-present. The initial version was done over my summer holiday, and further work was done during my PhD. During Summer 2008 I was funded to full-time on Hoogle by Google Summer of Code with the mentoring organisation. Since then I have been working on Hoogle in my spare time. Various people have given lots of useful ideas, including my PhD supervisor Colin Runciman, and various members of the Plasma group. In addition, the following people have also contributed code or significant debugging work:

In previous versions, all the data was taken from Zvon’s Haskell Guide. Thanks to their open and friendly policy of allowing the data to be reused, this project became possible. More recent versions use the Hierarchical Libraries as distributed with GHC, and databases generated by Haddock.


Changelog for Hoogle

#115, require warp-2.1 or above
#107, fix the keywords URL moving
#106, shake-0.15 compatibility
#96, allow certicate verification failures
#95, allow a higher version of Cabal on older GHCs
#94, GHC 7.10 support
#85, add support for missing type constructors
Allow haskell-src-exts-1.16
Add defaultDatabaseLocation
Allow WAI-3.0
Allow haskell-src-exts-1.15
#61, support conduit-1.1
#57, support QuickCheck-2.7
#55, if reading as UTF8 fails, explicitly try Latin1
Add QuickCheck as a dependency
Change createDatabase to also save the file
Disable rank feature
Remove running a hoogle query without converting the database
Ignore packages without documentation to hoogle data
Upgrade to shake-0.11
#49, update "hoogle data" to be incremental
Rewrite how "hoogle data" works
#45, if you are building all, also depend on default
#47, switch to using Shake to build the recipes
Add a dependency on Shake
Fix omission of the Test file
Fix timestamps in .tar.gz dist file
Allow WAI 2.0
Fix the Keyword generator
Improvements to Haddock conversion
Download Hoogle data from the old Hackage server
#25, make the tarball pass the tests
#26, GHC 7.8 compatibility
Ensure alias resolution is bottom-up and recursive
#619, do not depend on unix on Windows
Fix version bounds
Allow bytestring-0.9
Upgrade to haskell-src-exts-1.14
Visual redesign
Require bytestring-0.10 or above, due to NFData instances
Add NFData instance to Database
Remove lots of explicit upper bounds
Allow http-types-0.8
Allow case-insensitive-1.0
Support --local for GHC docs
#568, rewrite Haddock links in --local
Switch license from GPL to BSD3
GHC 7.6 fixes
##4, Allow Cabal-1.16.*
Allow cmdargs-0.10.*
Allow conduit-0.5, wai-1.3 and warp-1.3
Upgrade to http-types-0.7.*
In embedded mode, don't hijack the URL bar or title
Upgrade to jQuery 1.7.2
#89, add a format=json output mode
#476, update the URL as you type
Improve iPhone support
Update the copyright year in the footer
Double the speed of hoogle server responses
Allow transformers-0.3
Allow conduit-0.4, wai-1.2 and warp-1.2
Allow haskell-src-exts-1.12 and 1.13
#533, be paranoid when parsing Cabal files
Upgrade to WAI-1.1 and Warp-1.1
#525, don't rely on a redirect to find files
Allow Cabal-1.14
Allow cmdargs-0.9
Fix setting the global read flags and unsetting them properly
Allow case-insensitive-0.4.*
Make data --local have a good default on Linux
Make server --local work on Windows
#407, rewrite OpenSearch plugin to work regardless of the server
Allow cmdargs-0.8
Permit GHC 7.2
Allow case-insensitive-0.3.*
Fix bug when searching for toString in the embed mode
Make --redownload work on the tarballs
Fix hyperlinks to symbols (i.e. &&) in Haddock
#434, use either wget or curl to download the files
Allow haskell-src-exts 1.11.*
Upgrade to cmdargs==0.7.*
Generate database for ghc internals
Give an error if the database is the wrong version
Add -fno-cse, to make cmdargs work (was losing args annotations)
Upgrade to WAI==0.4.* and Warp==0.4.*
Allow parsec 3, since various people have reported it works
Default module URL's correctly when not on Hackage
#417, use proper Haddock parsing for package descriptions
Make sure https: links work through the web mode
Rewrite the binary defer layer, cleaner and slightly faster
Eliminate escaping problems when entering "'s in the search
Some work on #375, add links to the library page
Add --template to override the templates at runtime
Add --dynamic flag to server mode, include update stamps
Upgrade wai and warp, adds an exception handler
#82, rewrite showing document snippets, better expand/collapse
Support <em> tags in Haddock output (as well as <i>)
Make package matching case insensitive
#372, add features to improve module name search
Make module name searching case insensitive
Fix for pattern match failure when searching for "to"
Fix for not sending text/html when serving local files
Eliminate the --nostdin flag, now unnecessary
Change to use WAI/Warp instead of HTTP and custom server
Fix a bug, didn't ever show Waiting... on the real website
Make embed work in IE8
Make the CGI interface send the right number of newlines
Accept prefix and suffix web parameters
Eliminate isBlankQuery, make Query a Monoid
Make Query abstract, add queryPackages/querySetPackage
Rename querySuggestions/queryCompletions by dropping the query
Add mode=embed support
Add some log analysis features
Ignore some whitespace in the input file
Work around a cabal bug, include jquery.cookie.js
Add ?version=xxx to .css and .js, to make it auto refresh
#399, rehabilitate mode=suggest
Stop mode=suggest failing entirely, now cleanly gives no answers
Combine --web and --webmode
Complete the command line flag help
#327, ensure utf8 is found
#187, ensure LT is found
Use the Hoogle tarball direct from Hackage
#54, rework packages, entries and keywords
#87, make all database files lowercase
Various javascript/ajax enhancements
Running data on Posix sets all files to global read/execute
Relax haskell-src-exts to allow 1.10.1
Rework the web page display further
Read and write all database files in UTF8
#391, add tar -xzf when extracting from the tarball
Change search results display, packages/modules on separate line
Exclude haskellN* from the platform, they are in base
Add --nostdin to server mode, to support running with nohup
Loosen dependencies for tagsoup (typo'd it before)
Loosen dependencies for tagsoup and HTTP (but not parsec)
Avoid self circular dependencies
#195, include all the necessary resources to run as a server
When in server mode, be more robust to errors
#320, make sure system is found
#146, preserve forall's in everywhere
#186, switch to using haskell-src-exts to parse input files
#249, make sure you find MonadWriter
#235, make sure you find forall
#309, make sure there are links for keywords
#78, add --link flag
#59, operators look nicer, and have blue brackets round them
#352, can now parse ( # ) as a function name in the input
#280, searching for "~ +keyword" should find keyword
#116, fix links for types/classes
#83, all searching for package-name
#94, allow textbases to be used automatically
#92, short flags are now handled by cmdargs, so work
#51, test mode now does what test and testfile did
#66, turn Hoogle into a library
Add --server flag, to run as a server
Start of changelog