I have a.ml
like this:
module type ASig =
sig
val do_something : unit -> int;;
end ;;
module A:ASig =
struct
let do_something () = 1;;
let do_secrectly () = 2;;
end;;
So for my module A, the interface should be only do_something()
.
But if I use ocamldoc -html a.ml
, although the module sig declares the interfact, the doc still exposes all functions in module A like:
module A: sig .. end
val do_something : unit -> int
val do_secrectly : unit -> int
How should I use ocamldoc
so that all documents are based on module sig
?
This is, unfortunately, not possible with the current implementation of ocamldoc: it takes constraint into account but at a purely syntactical level, it can only use them when they are of the explicit form sig ... end
instead of referring to an existing identifier (because the analysis is done by hand on the parsed syntax tree, and not on the typed tree).
You can either:
use a .mli
and document there (if you only provide the .mli, only what's in it will be documented)
or use the markup (**/**)
to tell ocamldoc to discard the rest of the module, module type, etc., before the functions you want to keep private.