Simply put, let us say I have an implementation file called moduleExample.ml and an interface file in the same directory called moduleExample.mli.
How could I load them together in such a way that the functions not listed in the interface moduleExample.mli are hidden from moduleExample.ml's signature in utop? Additionally, how about type abstraction through the moduleExample.mli file?
I think the proper method to do that, or more generally load within a toplevel a whole project of several modules and interfaces, is to use a build system to compile all modules and link them within a toplevel.
Using dune, you can do that by doing
dune utop directoryas described here. For exhaustiveness here's an architecture example:dune.ml
ex.ml
ex.mli
Loading all that into utop by doing
dune utop .and then using the#showdirective on the moduleEx, gives: