EDIT: See answer from @johnj, it’s much better
Hey! In ReScript/ReasonML/OCaml file names are always modules and folders do not mean anything from namespacing point of view.
If you want the module structure you described, you need to have exactly these two files
Both files then contain two modules,
On the other hand, if you (will) have huge amount of files and wish to create a folder structure, you still need to namespace each individual file as they were all in the root. A popular strategy is to do something like this:
The modules are accessed as there were no folders at all, e.g.
Here’s a nice in-depth article about the latter strategy: https://dev.to/yawaramin/a-modular-ocaml-project-structure-1ikd