A compilation unit is pair of OCaml source files in the same directory. They have the same base name, say mod, but different extension names: mod.ml and mod.mli. We call the former implementation and the latter interface.

mod.mli acts the same role as module type = sig end, while mod.ml acts the same role as module = struct end.

Documentary Comments

We put documentary comments in interface file rather than implementation file, and is often put after an element of the interface. For example

1
2
val pi : float
(** The mathematical constant 3.14 *)