ocamlocaml-dune

How do I determine what modules an OCaml library provides?


I'm just starting a project to analyze C programs using goblint-cil.

I know I needed to use a library to import it. The README for goblint-cil says the following:


# #use "topfind";;
# #require "goblint-cil";;
# GoblintCil.cilVersion;;
- : string = "2.0.3"

I then made a dune file requiring it:

(executable
  (libraries goblint-cil)
  (name main))

I have two basic questions about libraries in Ocaml:

  1. How do I find out what modules a library or package provides? In the case of GoblintCil it was right there in the README, but I would like to know if this library provides any other modules.
  2. What is the relation between libraries, packages, and modules? It seems to me the following are true:
  • Every .ml file forms a module by capitalizing it
  • Packages are just a collection of libraries and (potentially empty) set of executables
  • Libraries are a sub-collection of modules in a package

Are these correct?


Solution

  • You can:

    #require "base";;
    #show Base;;