Improved Toplevel Workflow in Dune

I’d like to highlight a new toplevel feature introduced in the recently released dune 3.6.0. We have the new top-module subcommand for loading modules without hiding their interface behind their mli. This means that the following:

$ utop
# #use_output "dune ocaml top-module path/to/module.ml";;

Will allow you to inspect Module as if module.mli was absent.

The inspiration for this feature is of course the REPL driven development environments that are so common in Lisps. Obviously, we’re still pretty far from catching up to Lisp in this regard, but I’m already quite happy with this small improvement. I look forward to adding more features to dune to support this style of development in the future.

23 Likes

This is great! Thank you, I’ve wanted this from the beginning of my OCaml-ing.

1 Like