hugomg
hugomg

Reputation: 69934

How can I use ocamlbrowser with opam packages?

My system ocaml instalation also includes the /usr/bin/ocamlbrowser executable. Is there a way I can use it to browse packages I installed with opam?

So far the closest I could get was using the -I flag to add extra directories to the search but I don't know how to tell it to search all folders (the -I flag only adds one at a time) and I don't know how to access the source code for the functions (ocamlbrowser is only finding the mli files, not the ml)

 ocamlbrowser -I ~/.opam/system/lib/core -I ~/.opam/system/lib/fieldslib

Upvotes: 1

Views: 262

Answers (1)

camlspotter
camlspotter

Reputation: 9030

OCamlBrowser is rather legacy and you need manually specify all the include directories.

For code browsing, ~/.opam/<switch>/lib/* dirs are not sufficient since they usually lack source codes (.ml and .mli's).

You should use the build directories, ~/.opam/<switch/build/packagename/... instead, keeping the source code of the installed OPAM packages. You need to set OPAMKEEPBUILDDIR env var or opam install --keep-build-dir for it.

AFAIK, currently (2014/09) we have no alternatives which is 100% compatible with OCamlBrowser which work fully with OPAM/OCamlFind eco system, but we have ocp-index, ocp-browser and http://ocamloscope.herokuapp.com/ . However, things are rapidly evolving around OPAM and newer tools may be released.

Upvotes: 4

Related Questions