I wonder if is there any ways to make OCaml compiler report warnings about unused functions? I googled but there are not much topics discussed about this feature.
In particular, in the following program, there are two functions "foo" and "bar" which are declared but "bar" is not used in the "_" function. So I think that the OCaml compiler should report "bar" as an unused function.
let foo x y = x + y
let bar x y z = x + y + z (* should be reported unused *)
let _ =
let x = foo 1 2 in
x
You need to define a (possibly-empty)
.mli
interface file saying what this module exports. Otherwise, you're just defining abar
function for other modules to use.(and make sure you're compiling with warnings on, of course)