OCaml 类型导向 API 搜索

OCaml type-directed API search

OCaml 中是否有类型导向的搜索工具(如 Coq 的 SearchPattern 命令),我可以在其中定义类型约束,例如_ * int -> float,然后该工具将在给定的一组文件中搜索 "all functions mapping pairs whose second element is an integer to floats"?

无论是独立工具,还是集成到 IDE 中的东西都可以。这个想法是,当探索一个新的 API 时,如果我想获得一个 Foo.t 类型的值,寻找 _ -> Foo.t 形式的所有函数可能比浏览更有效整个 API.

Merlin 有助于找到给定表达式的类型,但据我所知,它没有这样的 "API discovery" 函数。

我找到了 OcamlScope,但它似乎是一个仅限网络的服务,并且仅限于一组固定的库。我希望能够在我自己的文件中搜索现有功能。

ocamloscope 的源代码可以在这里找到 https://github.com/camlspotter/ocamloscope/. You may succeed to use it locally. There's even an issue 用于制作 OPAM 包。