OCaml tool: type sig -> list of names?

Is there an OCaml tool where as input, I specify a type sig, and as output, it give me a name. For example:

input: 'a list → ('a → 'b) → 'b list
output: List.map

input: 'a list → ('a → 'b option) → 'b list
output: List.filter_map

etc …
it’s fine if the output is more than one function

This is similar to Hoogle https://hoogle.haskell.org/ in the Haskell world. I know there are people interested in exploring this idea in OCaml, but as far as I know this doesn’t yet exist.


1 Like

There are actually a couple such tools in the ecosystem that do this.

First of all, sherlodoc: https://doc.sherlocode.com/, which searches not only types but also documentation:

Also, for a local tool, I think there’s dowsing: GitHub - Drup/dowsing: ᚛ A type of divination employed in attempts to locate identifiers matching a given type expression, although not sure it’s been released


Also specific to the OCaml API, you can search by types in the manual… And Merlin offers a similar feature which I believe is project-wide… We already have step 1, a central package index, covered… Just need to consolidate these individual effots to give that index a good API search tool.

1 Like

Thanks! I wasn’t aware of it.


sherlocode just answered a query I had; I’ll start using it more.