• Stars
    star
    689
  • Rank 65,628 (Top 2 %)
  • Language
    Haskell
  • License
    Other
  • Created over 12 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Haskell API search engine

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

More Repositories

1

hlint

Haskell source code suggestions
Haskell
1,459
star
2

ghcid

Very low feature GHCi based IDE
Haskell
1,130
star
3

shake

Shake build system
Haskell
744
star
4

tagsoup

Haskell library for parsing and extracting information from (possibly malformed) HTML/XML documents
Haskell
231
star
5

bake

UNMAINTAINED: Continuous integration server
Haskell
130
star
6

record-dot-preprocessor

A preprocessor for a Haskell record syntax using dot
Haskell
129
star
7

weeder

Detect dead exports or package imports
Haskell
124
star
8

debug

Haskell library for debugging
JavaScript
121
star
9

rattle

Forward build system with speculation and caching
Haskell
102
star
10

spaceleak

Notes on space leaks
Haskell
101
star
11

extra

Extra Haskell functions
Haskell
93
star
12

cmdargs

Haskell library for command line argument processing
Haskell
91
star
13

build-shootout

Comparison of build program expressive power
Haskell
88
star
14

uniplate

Haskell library for simple, concise and fast generic operations.
Haskell
74
star
15

safe

Haskell library for safe (pattern match free) functions
Haskell
45
star
16

ghc-make

An alternative to ghc --make which supports parallel compilation of modules and runs faster when nothing needs compiling.
Haskell
40
star
17

interpret

Rust
38
star
18

neil

General tools for Neil
Haskell
38
star
19

profiterole

GHC prof manipulation script
Haskell
30
star
20

nsis

Haskell DSL for producing Windows Installer using NSIS
Haskell
26
star
21

derive

A Haskell program and library to derive instances for data types
TeX
25
star
22

supero

Haskell optimisation tool based on supercompilation
Haskell
25
star
23

hexml

A bad XML parser
C
19
star
24

offline-stack

Install Stack without internet access
Haskell
18
star
25

catch

Haskell pattern match analsyis checker
Haskell
15
star
26

js-jquery

Haskell library to obtain minified jQuery code
Haskell
9
star
27

rexe

.exe forwarder, to allow replacing binaries on PATH
Haskell
8
star
28

office

Macros for Microsoft Office
VBA
7
star
29

VSHaskell

Visual Studio 2010 addin
C#
7
star
30

record-hasfield

A version of HasField that will be available in future GHC
Haskell
7
star
31

shake-paper

Paper on the new GHC Shake-based build system
HTML
6
star
32

lasagna

Checker for Haskell layering violations
Haskell
5
star
33

guihaskell

A graphical REPL and development environment for Haskell
Haskell
5
star
34

hwwg

Haskell Website Working Group
5
star
35

shake-bazel

Experimenting with Shake and Bazel combined
Haskell
4
star
36

blogs

TeX
4
star
37

haskell-parser

Haskell parser based on that from GHC
Haskell
4
star
38

filepattern

A file path matching library
Haskell
4
star
39

idris-playground

Playing around with Idris
Idris
4
star
40

proplang

A Haskell library for functional GUI development
Haskell
4
star
41

thesis

My PhD thesis - Transformation and Analysis of Functional Programs
Haskell
3
star
42

js-flot

Haskell library to obtain minified Flot code
Haskell
3
star
43

qed

Experiments writing a prover
Haskell
3
star
44

core-playground

Simple Core language for Haskell experiments
Haskell
3
star
45

js-dgtable

Haskell library to obtain minified jquery.dgtable code
JavaScript
3
star
46

neil-check

Run neil and hlint on all my projects
Haskell
3
star
47

shake-examples

3
star
48

proof

Haskell library for writing proofs
Haskell
2
star
49

ci-check

Test the various supported CI's
2
star
50

hogle-dead

This repo has been moved to the master branch of https://github.com/ndmitchell/hoogle.
Haskell
2
star
51

stack-3137

Reproduce https://github.com/commercialhaskell/stack/issues/3137
Haskell
2
star
52

winhaskell

Windows Haskell GUI interpretter
C++
1
star
53

fossilizer

Generate 3D images of fossil bedding surfaces
JavaScript
1
star
54

bug-i386-ghc84

1
star
55

proposition

Haskell library for manipulating propositions.
Haskell
1
star
56

tex2hs

A program to check for type errors in a Latex document
Haskell
1
star
57

ndmitchell

1
star
58

hlint-test

Haskell
1
star
59

ghc-process

Compiling and linking files in a single process using the GHC API
Haskell
1
star
60

shark

A bad replacement for cabal/stack
1
star
61

index-search

Searching compressed text indicies
C
1
star
62

awesomo

Prototype optimiser for Haskell programs
Haskell
1
star
63

ninjasmith

Ninja file generator and tester
Haskell
1
star
64

firstify

A Haskell library to transform Yhc Core programs to first-order
TeX
1
star