package omod
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha512=ba4922a3ff0c549a288908d0506ad8e53a0b256c3c564987a8026c6619f2ce5025d930671452caa250d2e23234b6aa29a5fb0b138ada37cb8a1d535c2968ba24
doc/tutorial.html
Omod tutorial
To use the toplevel helpers simply bring the Omod module in your scope: type or add the following line to your ~/.ocamlinit file.
#use "omod.top"
Now whenever you want to use a module named M invoke:
# Omod.load "M"This will recursively load its dependencies and toplevel init files. See Omod.load for more options and details.
If you are using omod in scripts you should also specify the package PKG where M should be found using the PKG.M syntax. This because a further package install could also install a module M resulting in a load ambiguity and your script no longer working.
If you run into multiple load sequence resolutions, Omod interactively asks to choose one of the possible sequences. Assuming you have the package ptime installed this is an example (note ptime will switch to a different technique which doesn't need library variants for the js_of_ocaml support, so the following may no longer be a good or working example in the future) :
# Omod.load "Ptime_clock"since ptime provides an os clock for your operating system and a jsoo clock for your browser.
The ambiguity can be automatically resolved by specifying the variant you want explicitly (see Omod.load for details) for example to directly request the OS clock you should issue:
# Omod.load "Ptime_clock@clock/os"In a script it would even be better to write:
# Omod.load "ptime.Ptime_clock@clock/os"Finally to list what was loaded by Omod type:
# Omod.status ()For information about how Omod locates packages, consult omod conf --help.