-
I have a dune/ocaml project.
-
If I run ‘dune utop’, it loads all the modules in the dune project.
-
However, I can’t run “dune utop” while there is a “dune build -w” running.
-
I can run a regular “utop” while there is a “dune build -w” running.
-
From the regular utop, how do I load all of _build/**/*.cmo ? (I.e. load all modules compiled in the dune proejct).
It looks like this bug in dune is already tracked here:
As for the question in itself, this should work fine:
#use_output "find _build/default/ -name '*.cmo' | while read x ; do echo "#load \"${x}\";;" ; done";;
Dumb followup: does *.cmo files provide type checking info? From googling around, I’m getting a message of the form:
#load “…” only loads the object file
if I actually want type checking / being able to call it from the utop REPL, I need to do something involving _directory and mli files too ?
(Just running #load “…” is NOT giving me auto completions on modules or even the module names in utop).
Ah, I think I’m starting to see the connection.
We can’t use # #use_output "dune ocaml top";;
(again, due to the dune shared build issue); so we are manually trying to emulate that ?
yes exactly. Note that dune top
is also a shorter alias for dune ocaml top
.