Is there any way to add functions to an already existing module in OCaml?
Specifically, I have some module Loc that tracks locations in a source file. I also have a module called Ast that represents the abstract syntax tree of some code. I want to have the method Loc.of_ast defined in ast.ml, and thus an extension of Loc. Is there any way to do this?
Note: This might be an XY problem. The reason that I'm inclined to believe that such module extensions are possible is because, in Batteries, there are methods such as String.of_int and Int.of_string, which implies these modules are mutually recursive. Surely they aren't all entirely defined in the same file...