Using Modules (15 characters long now)

In the tutorial setup lib/dune contains:

(library
 (name hello))

From that, there are two options:

  1. With a lib/hello.ml file, as you found
  2. 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