This is a little bit of “magic” that dune is adding to your structure.
That file lib/new.ml
isn’t automatically available as Lib.New
- what dune is doing is:
- Seeing that you don’t have a
lib.ml
in that directory - Creating a template one that does something like
module New = New
This means that Lib
now exports New
as a sub-module.
If you create your own lib.ml
(a file matching the directory) then dune will assume you know what you are doing and skip the above.
That lets you choose to not export all the sub-modules or to rename them etc. You might find it helpful to try doing that to “bed down” the understanding.
It does catch you out the first time though (or at least it caught me out) because you are learning a lot of things all at once.