OCaml Style API Search
Does OCaml (like Coq SearchPattern
) have a type-oriented lookup type where I can define a type constraint like. _ * int -> float
and then the tool will search for a given set of files for "all functions displaying pairs whose second element is a floating integer"?
Either a standalone tool or something integrated into the IDE will be fine. The idea is that when learning a new API, if I want to retrieve a type value, for example Foo.t
, finding all the functions of a form _ -> Foo.t
might be more efficient than throwing the entire API.
Merlin helps to find the type of the given expressions, but it doesn't have such API detection functionality as far as I know.
I found OcamlScope , but it seems to be a web service and limited to a set of fixed libraries. I wanted to be able to search my own files for existing functions.
source to share
ocamloscope
the source can be found here https://github.com/camlspotter/ocamloscope/ . You can use it locally. There's even an issue for creating an OPAM package.
source to share