hoogle: Haskell API Search

[ bsd3, development, library, program ] [ Propose Tags ] [ Report a vulnerability ]

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.


[Skip to Readme]

Modules

[Index] [Quick Jump]

Downloads

Note: This package has metadata revisions in the cabal description newer than included in the tarball. To unpack the package including the revisions, use 'cabal get'.

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 3.1, 4.0, 4.0.0.1, 4.0.0.2, 4.0.0.3, 4.0.0.5, 4.0.6, 4.0.7, 4.1, 4.1.1, 4.1.2, 4.1.3, 4.1.4, 4.1.5, 4.2, 4.2.1, 4.2.2, 4.2.3, 4.2.4, 4.2.5, 4.2.6, 4.2.7, 4.2.8, 4.2.9, 4.2.10, 4.2.11, 4.2.12, 4.2.13, 4.2.14, 4.2.15, 4.2.16, 4.2.17, 4.2.18, 4.2.19, 4.2.20, 4.2.21, 4.2.22, 4.2.23, 4.2.24, 4.2.25, 4.2.26, 4.2.27, 4.2.28, 4.2.29, 4.2.30, 4.2.31, 4.2.32, 4.2.33, 4.2.34, 4.2.35, 4.2.36, 4.2.37, 4.2.38, 4.2.39, 4.2.40, 4.2.41, 4.2.42, 4.2.43, 5.0, 5.0.1, 5.0.2, 5.0.3, 5.0.4, 5.0.5, 5.0.6, 5.0.7, 5.0.8, 5.0.9, 5.0.10, 5.0.11, 5.0.12, 5.0.13, 5.0.14, 5.0.15, 5.0.16, 5.0.17, 5.0.17.1, 5.0.17.2, 5.0.17.3, 5.0.17.4, 5.0.17.5, 5.0.17.6, 5.0.17.7, 5.0.17.8, 5.0.17.9, 5.0.17.10, 5.0.17.11, 5.0.17.12, 5.0.17.13, 5.0.17.14, 5.0.17.15, 5.0.18, 5.0.18.1, 5.0.18.2, 5.0.18.3, 5.0.18.4 (info)
Change log CHANGES.txt
Dependencies aeson, base (>4 && <5), binary, blaze-html, blaze-markup, bytestring (>=0.10.2.0), cmdargs, conduit (>=1.3.0), conduit-extra (>=1.2.3.2), containers (>=0.5), crypton-connection (==0.3.2), deepseq, directory, extra (>=1.6.6), filepath, foundation (>=0.0.13), hashable, haskell-src-exts (>=1.22 && <1.24), hoogle, http-conduit (>=2.3), http-types, js-flot, js-jquery, mmap, old-locale, process-extras, QuickCheck, resourcet, safe (>=0.3.20), semigroups (>=0.18), storable-tuple, tar, template-haskell, text, time (>=1.5), transformers, uniplate, utf8-string, vector, wai, wai-logger, warp, warp-tls, zlib [details]
Tested with ghc ==9.8, ghc ==9.6, ghc ==9.4
License BSD-3-Clause
Copyright Neil Mitchell 2004-2024
Author Neil Mitchell <ndmitchell@gmail.com>
Maintainer Neil Mitchell <ndmitchell@gmail.com>
Revised Revision 1 made by NeilMitchell at 2024-07-28T21:48:40Z
Category Development
Home page https://hoogle.haskell.org/
Bug tracker https://github.com/ndmitchell/hoogle/issues
Source repo head: git clone https://github.com/ndmitchell/hoogle.git
Uploaded by NeilMitchell at 2024-01-14T11:31:50Z
Distributions Arch:5.0.18.4, Debian:5.0.18.1, FreeBSD:4.2.41, LTSHaskell:5.0.18.4, NixOS:5.0.18.4, Stackage:5.0.18.4
Reverse Dependencies 6 direct, 0 indirect [details]
Executables hoogle
Downloads 118785 total (140 in the last 30 days)
Rating 2.5 (votes: 4) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2024-01-14 [all 1 reports]

Readme for hoogle-5.0.18.4

[back to package description]

Hoogle Hackage version Stackage version Build status

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. The online version can be found at https://hoogle.haskell.org/ and searches Stackage.

Hoogle Use

Hoogle can be used in several ways:

Searches

Searching

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"

Scope

By default, searches look at the Haskell Platform and Haskell keywords. However, all Stackage 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

Integration

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 generate

Which will download and build Hoogle databases.

Command Line UI

There is a terminal/curses based UI available through cabal install bhoogle.

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 symbol at the right of the URL bar, and select the "Add Search Engine" option. Click the hoogle logo at the bottom of the completion dropdown when searching to perform a Hoogle search.

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".

Others

The Source Code

$ git clone https://github.com/ndmitchell/hoogle.git

Contributions are most welcome. Hoogle is written in Haskell 98 + Heirarchical Modules, I do not wish to change this. Other than that, I'm pretty flexible about most aspects of Hoogle. The issue tracker has many outstanding tasks, but please contact me if you have thoughts on doing something major to Hoogle, so I can give some advice.

Background

Hoogle work is licensed under the BSD-3-Clause license.

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.

Project Structure

The folders in the repository, and their meaning are:

cbits - C implementation of the text search used by hoogle

docs - documention on hoogle

html - resources for hoogle's web front-end (html, css, javascript, images, etc.)

misc - scripts, logos, sample data, etc.

src - haskell source code

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 :(
  • Cloogle, for the Clean language

Acknowledgements

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 haskell.org 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:

  • Thomas "Bob" Davie
  • Don Stewart
  • Thomas Jager
  • Gaal Yahas
  • Mike Dodds
  • Niklas Broberg
  • Esa Ilari Vuokko
  • Udo Stenzel
  • Henk-Jan van Tuyl
  • Gwern Branwen
  • Tillmann Rendel
  • David Waern
  • Ganesh Sittampalam
  • Duncan Coutts
  • Peter Collingbourne
  • Andrea Vezzosi
  • Ian Lynagh
  • Alfredo Di Napoli

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.

Interesting links