In the tutorial setup lib/dune
contains:
(library
(name hello))
From that, there are two options:
- With a
lib/hello.ml
file, as you found - Without a
lib/hello.ml
file, as described by @yawaramin.
However, you can expose other modules from the lib
folder (your mymodule.ml
) even in case 1. You need a hello.ml
file looking like this:
module Mymodule = Mymodule
let text = "hi"
You’ll be able to use: Hello.Mymodule.f
and Hello.text
. If you write module Foo = Mymodule
, then Hello.Mymodule.f
becomes available as Hello.Foo.f