module type S =sig
..end
include Printer_api.S_pp
class extensible_printer :unit ->
Printer_api.extensible_printer_type
Extend this class if you want to obtain a custom pretty-printer.
module type PrinterClass =sig
..end
Auxiliary module type for a pretty-printer
module type PrinterExtension =functor (
X
:
PrinterClass
) ->
PrinterClass
Signature for extending an existing pretty-printer.
val update_printer : (module Printer_api.S.PrinterExtension) -> unit
Register a pretty-printer extension. The pretty-printer passed as
argument X
in the functor Printer_api.S.PrinterExtension
is the current
pretty-printer, which you should inherit from.
This is how this function should be used:
module PrinterClassDeferred (X: Printer.PrinterClass) = struct
class printer : Printer.extensible_printer = object(self)
inherit X.printer as super
(* Override the standard methods *)
end
end
let () = Printer.update_printer
(module PrinterClassDeferred: Printer.PrinterExtension)
val current_printer : unit -> (module Printer_api.S.PrinterClass)
Returns the current pretty-printer, with all the extensions added
using Printer_api.S.update_printer
.
val set_printer : (module Printer_api.S.PrinterClass) -> unit
Set the current pretty-printer, typically to a printer previously
obtained through Printer_api.S.current_printer
. This can be useful to cancel a
modification performed through Printer_api.S.update_printer
.