package quill
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=96d35ce03dfbebd2313657273e24c2e2d20f9e6c7825b8518b69bd1d6ed5870f
sha512=90c5053731d4108f37c19430e45456063e872b04b8a1bbad064c356e1b18e69222de8bfcf4ec14757e71f18164ec6e4630ba770dbcb1291665de5418827d1465
doc/quill.top/Quill_top/index.html
Module Quill_topSource
OCaml toplevel kernel for Quill.
Provides an in-process OCaml toplevel as a Quill.Kernel.t. Stdout and stderr are streamed in real time during execution. Rich outputs (images, HTML) are emitted via Quill.Cell.Display_tag semantic tags on the toplevel formatter.
initialize_if_needed () ensures the OCaml toplevel environment is initialized. Safe to call multiple times; only the first call has effect.
add_packages pkgs resolves each findlib package name and adds its directory to the toplevel load path, marking each as already linked into the executable. Unknown packages are silently skipped.
load_package pkg resolves the findlib package pkg and all its transitive dependencies, adds their directories, and dynamically loads their bytecode archives. Packages already loaded or marked in-core via add_packages are skipped. Raises if the package is not found.
install_printer name installs a toplevel pretty-printer by evaluating #install_printer name;;. The printer must be resolvable in the current toplevel environment (i.e. its module directory was previously added via add_packages). Silently does nothing on failure.
install_printer_fn ~ty f registers f as a pretty-printer for values of type ty (e.g. "Hugin.figure"). The type is looked up in the toplevel environment. Unlike install_printer, the function does not need to be resolvable by name -- it is passed directly. Silently does nothing if the type cannot be resolved.
val create :
?setup:(unit -> unit) ->
on_event:(Quill.Kernel.event -> unit) ->
unit ->
Quill.Kernel.tcreate ?setup ~on_event () creates a new OCaml toplevel kernel. Kernel events are delivered by calling on_event. setup is called once before the first cell execution, after toplevel initialization -- use it to call add_packages and install_printer.