I have the following structure:

src/
├─ instructions/
│  ├─ dune
│  ├─ arithmetic.ml
│  ├─ bitwise.ml
│  ├─ ...
├─ dune
├─ base_types.ml
├─ memory.ml
├─ ...

Everything in src should be a library, but I also want things in src to be able to access modules such as Instructions.Arithmetic, while modules in instructions/ should be able to open Base_types.

First question, my understanding is that this is something that (include_subdirs qualified) aims to do. Is this possible to emulate right now?

Second question, is it possible for modules in instructions/ to be aware of modules in the parent directory without using (include_subdirs unqualified)? or is this a bad structure? I want to have open Base_types in arithmetic.ml, but I get:

Error: Unbound module Base_types

Essentially, it seems I want (include_subdirs unqualified), but also need the subdirectories to be their own sub libraries as with qualified.

Advice would be greatly appreciated.

0

There are 0 best solutions below