Module Quill.Kernel
Code execution kernels.
A kernel executes code and produces outputs. The interface is abstract to support different backends: in-process toplevels, subprocess-based kernels, remote kernels, etc.
Kernel status
Kernel events
type event = | Output of {cell_id : Cell.id;output : Cell.output;
}| Finished of {cell_id : Cell.id;success : bool;
}| Status_changed of status(*The type for kernel events.
Outputis emitted for each piece of output during execution.Finishedsignals that execution of a cell has completed.Status_changedsignals a kernel lifecycle change.
Completions
The type for completion items. label is the identifier name, kind classifies it, and detail is a formatted type signature.
Intellisense
The type for diagnostics. Positions are byte offsets within the cell.
The type for type-at-position results. typ is the formatted type, doc is the optional documentation string, and positions delimit the expression span.
Kernel interface
type t = {execute : cell_id:Cell.id -> code:string -> unit;interrupt : unit -> unit;complete : code:string -> pos:int -> completion_item list;type_at : (code:string -> pos:int -> type_info option) option;diagnostics : (code:string -> diagnostic list) option;is_complete : (string -> bool) option;status : unit -> status;shutdown : unit -> unit;
}The type for kernel handles.
execute ~cell_id ~codesubmits code for execution. Results are delivered aseventvalues through the callback registered at kernel creation time.interrupt ()requests interruption of the current execution.complete ~code ~posreturns completion candidates at the given cursor position incode.type_atwhenSome f,f ~code ~posreturns type information at the given cursor position.diagnosticswhenSome f,f ~codereturns parse and type errors.is_completewhenSome f,f codereturnstrueifcodecontains a complete toplevel phrase ready for execution.status ()returns the current kernel status.shutdown ()initiates graceful shutdown.