# Hoogle searches Haskell libraries by type signature

> Hoogle is an API search engine for Haskell that matches either function names or approximate type signatures across the Haskell Platform and all Stackage packages. It is a good answer to 'which function takes this type', and it is not a code search engine.

**ndmitchell/hoogle** — Haskell API search engine

- Repository: https://github.com/ndmitchell/hoogle
- Website: http://hoogle.haskell.org/
- Stars: 803 · Forks: 153
- Language: Haskell
- License: NOASSERTION
- Published: 2026-10-20 · Updated: 2026-10-20 · Language: en
- Canonical page: https://hysenlabs.com/projects/ndmitchell-hoogle

## Looking up a Haskell function by the shape of its type

Hoogle answers a question that ordinary documentation search handles badly. Given a type, which function in the library has that type? The README describes it as a Haskell API search engine that lets you search many standard Haskell libraries by function name or by approximate type signature, and the online instance searches Stackage.

The users are Haskell programmers who know what they need at the type level but not the name. If you know the function is called map, you can find it in the docs. If you know you want something of type a -> a, or a -> b -> [a], the docs index by identifier and Hoogle indexes by shape. The theoretical basis is old work by Rittri and Runciman in the late eighties on using types as search keys in function libraries, later expanded by Di Cosmo in a book on type isomorphisms, and the README notes that the implementations that accompanied the earlier work targeted functional languages that have since become less popular.

That lineage explains the design better than any feature list. Hoogle is a retrieval system over a type index, and its value is highest for the standard library where a small number of functions covers many shapes.

The upstream complaint the project addresses is coverage. The online version indexes Stackage, so packages outside that selection are simply not searchable, whatever their documentation says.

## One query syntax mixes text, types and filters

The query language is where most of the learning curve sits, and the README gives enough examples to learn it from. A bare word is a text search. Two words separated by a space are searched as separate text terms, so con map finds concatMap but not map. A type is written with an arrow, and :: introduces a type position.

The examples in the README work like this:

```bash
mode +cmdargs
file -base
fold +Data.Map
```

A trailing :: a searches for the type a, and a query such as id :: a -> a searches for the text id and the type a -> a at the same time, which is how you narrow a broad type result down to one identifier.

The important part is the last line of the examples: a -> a finds id :: a -> a. The type is matched approximately rather than exactly, so a query type does not have to be the declared signature. This is the behaviour that makes the engine useful, since an approximate shape is usually what you have in mind.

It also explains the failure mode. An approximate match will return functions whose types are merely compatible with the one you typed, and the ranking between near and far matches is not something the README documents in detail. Expect to read the types of the top few results rather than trusting the first one.

## Package and module scoping use plus and minus prefixes

Search scope is controlled with a compact prefix syntax rather than a separate filter panel. By default a search looks at the Haskell Platform and the Haskell keywords, but every Stackage package is available to search.

A plus sign restricts the search to a named package, a minus sign removes one. The README gives the pattern directly: mode +cmdargs searches only the cmdargs package, file -base searches the Haskell Platform while excluding base, and mode +platform +cmdargs searches both the Haskell Platform and cmdargs. Package names are written in lower case, so the MissingH package is written as missingh, for example count +missingh searches only that package.

The same idea extends to modules. A query can restrict results to a module or exclude modules, so file -System drops results from modules such as System.IO, System.FilePath.Windows and Distribution.System, while fold +Data.Map finds results inside the Data.Map module. Since Haskell modules are hierarchical, excluding System removes a whole branch of the namespace rather than a single entry.

This is where the engine earns its keep in practice. A type-only query across the whole platform returns a wide field of plausible functions, and the module and package prefixes are what let you cut that field down to the part of the API you actually care about.

## A local Hoogle needs its database generated first

Hoogle can run locally, from a command line or in a browser, and the documentation points to a separate Install guide for that setup. The order of operations matters and is easy to get wrong.

Before searching, you need data files for the Hackage modules, which the README covers by telling you to run the generate step first. It downloads and builds Hoogle databases:

```bash
$ hoogle generate
```

Only after that does a query work:

```bash
$ hoogle "[a] -> [b]"
```

The README flags a detail that catches people out: the quotes matter, otherwise the shell will redirect the output to the file b. This is standard shell behaviour rather than a Hoogle quirk, but it is called out because the failure is silent and confusing.

The local database and the online instance are not equivalent in coverage. The online version at hoogle.haskell.org searches Stackage and is always current, while a local database covers the packages you generated it from. For day-to-day work the online instance or a browser keyword search is often the lower friction option, and the local install matters when you need offline access or want to search a package set you control.

## Five ways in: browser, terminal, editor, IRC and API

The same index is reachable through several front ends, and this is where Hoogle is unusual compared with a plain documentation site.

The online version has a web interface at hoogle.haskell.org, and the README documents browser integration in detail. In Chrome you add the site from the Hoogle search field as a search engine and give it a keyword such as h, then type h map in the location bar. In Firefox there are two routes: add it from the search bar and pick the hoogle logo from the completion dropdown, or add a keyword for the search and type the same h map form.

For editors, the README lists emacs integration through engine-mode. For IRC, there is a Lambdabot plugin with @hoogle and @hoogle+ commands. For terminal work there is a curses based UI, installed separately as cabal install bhoogle. And for developers, the project exposes Haskell and JSON APIs, described in a separate API document.

The developer-facing route is the one that turns Hoogle into infrastructure rather than a website. Anyone building a documentation search, a plugin or an editor tool can query the same index programmatically instead of scraping the web interface.

One caveat on the browser keyword trick: it works because the Hoogle site accepts the query in its search field, so it is subject to whatever the site's URL format is at the time. The README does not document a stable keyword API contract.

## Type search across a curated index, not the whole of Hackage

The main limitation is coverage. The online version searches Stackage, a curated selection of packages, and the README states plainly that all Stackage packages are available to search. A library on Hackage but outside Stackage is not in the index, and a function from it will not appear in a type search no matter how precisely you write the query.

The second limitation is that Hoogle is an API search engine and not a code search engine. The README lists similar tools and includes Krugle in that list with the blunt note that it searches code but no Haskell. Hoogle searches documented identifiers and their types, so it will not answer a question about how a function is used inside a body of code, and it will not find a helper that has no exposed name in the index.

The third is the fixed language constraint on the implementation itself. The README states that Hoogle is written in Haskell 98 with Hierarchical Modules and that the author does not wish to change this, while being flexible about most other aspects. That constraint keeps the codebase portable and readable for contributors, but it also means the internal code cannot use more modern language features to simplify things.

Practically, a Hoogle answer is a good starting point, not a final one. The results point at a signature; the Haddock documentation on Hackage remains the authority on behaviour.

## Hoogle next to Hayoo, Cloogle and plain web search

The README lists the alternatives itself, which is unusually candid. Hayoo is described as similar to Hoogle but with less focus on type search. Cloogle does the equivalent job for the Clean language rather than Haskell. Krugle searches code but, as the README notes, no Haskell. And Google is listed first, as the leader in online search.

The difference that matters between Hoogle and Hayoo is the index type. Hoogle's signature-first design, with approximate type matching, is what lets it answer a shape-of-the-type question. Hayoo's greater emphasis on ordinary text search makes it the better choice when you already know the name and want the documentation page.

The other difference is what the index contains. Hoogle's default scope is the Haskell Platform plus Haskell keywords, extended across Stackage, so its results are Haskell library identifiers rather than web pages. A general search engine will find tutorials, blog posts and forum threads that Hoogle cannot, and will miss the exact signature match you wanted.

The tooling rule of thumb that falls out of this: use Hoogle for API discovery by type, use Haddock and Hackage for authoritative documentation of a specific function, and use general web search for anything about how to use the language in practice.

## A slow-moving project under a permissive licence

Hoogle is BSD-3-Clause licensed, with the licence text in the LICENSE file at the repository root, and the README states that all code is copyright Neil Mitchell from 2004 onwards. BSD-3-Clause is permissive and imposes no obligations on downstream users beyond keeping the notice, so embedding Hoogle or its index in an internal tool carries no licensing friction. The trademark and the hosted service are separate matters from the code licence.

The maintenance picture is modest. The repository is not archived, and the last push was on 2026-07-04, but the only listed release is version 5.0.18.4 from 2024-01-14. That gap suggests a project in low-churn maintenance rather than one shipping frequent features, which is consistent with a design the author describes as settled.

The repository layout confirms a small, long-lived codebase. There is a src directory for the Haskell source, cbits holding the C implementation of the text search used by Hoogle, html with the resources for the web front end, docs for the documentation including the Install and API guides, and misc for scripts and sample data. Configuration files for hlint, stylish-haskell and weeder sit at the root, along with hoogle.cabal, Setup.hs, a .ghci file and two todo files, which is a fair picture of a project whose remaining work is tracked in plain text.

Contributions are welcome, and the README asks people to contact the author before undertaking anything major, so large changes are expected to be discussed rather than submitted as a patch.

## Conclusion

Use Hoogle when the question is which Haskell function has a given type, especially for standard library and Stackage work where you do not know the name in advance. Do not reach for it to search inside source code, to find third-party libraries that are not on Stackage, or to explore undocumented packages. Verify first that the package you need is indexed, then check the result against the Hackage documentation, because the index covers what Stackage has selected rather than every package ever uploaded. The last push was on 2026-07-04 and the last tagged release is version 5.0.18.4 from 2024-01-14.

## FAQ

### How do I install Hoogle and generate its database locally?

Install Hoogle following the project's Install document, then run hoogle generate to download and build the databases for the Hackage modules. Queries fail without that step, for example the shell redirects the output to a file named b unless you quote the query as hoogle "[a] -> [b]".

### How do I search for a Haskell function by its type?

Write the type with an arrow, for example a -> a, which the README shows finds id :: a -> a. Types are matched approximately, and a query can combine text and type, as in id :: a -> a.

### How do I restrict a Hoogle search to one package or module?

Use a plus sign to include a package and a minus sign to exclude one, for example mode +cmdargs, file -base or mode +platform +cmdargs, with package names written in lower case. Module restrictions work the same way, as in fold +Data.Map or file -System.

### Which packages does the online Hoogle cover?

The online version at hoogle.haskell.org searches Stackage, and the README states that all Stackage packages are available to search. By default a search looks at the Haskell Platform and Haskell keywords.

### What licence is Hoogle released under?

The README states that Hoogle work is licensed under the BSD-3-Clause license, with the text in the LICENSE file at the repository root. The most recent release listed is version 5.0.18.4 from 2024-01-14 and the last push was on 2026-07-04.

## Sources

- [Issues](https://github.com/ndmitchell/hoogle/issues)
- [ndmitchell/hoogle on GitHub](https://github.com/ndmitchell/hoogle)
- [Project website](http://hoogle.haskell.org/)
- [README](https://github.com/ndmitchell/hoogle/blob/master/README.md)
- [Releases](https://github.com/ndmitchell/hoogle/releases)

---

Hysen Labs editorial analysis, written from the project's own repository and release notes. Cite the canonical page: https://hysenlabs.com/projects/ndmitchell-hoogle
