OCaml source files are automatically modules, so you don’t need to declare nested modules with the module
and module type
keywords. Also, I strongly recommend that you match each directory’s name with the name of its main module. This will greatly reduce the number of different concepts you have to worry about:
bin/
bin.ml
dune
greeter/
dune
greeter.ml
greeter.mli
And the dune files:
; bin/dune
(executable
(name bin)
(libraries greeter))
; greeter/dune
(library
(name greeter))