Module Format_doc.Doc
module Doc: sig .. end
Definitions and immutable API for composing documents
Type definitions and core functions
type box_type =
|
| H
|
|
| V
|
|
| HV
|
|
| HoV
|
|
| B
|
Format box types
type stag = Format.stag
type element =
|
| Text of
| ||||
|
| With_size of
| ||||
|
| Open_box of
| ||||
|
| Close_box
| ||||
|
| Open_tag of
| ||||
|
| Close_tag
| ||||
|
| Open_tbox
| ||||
|
| Tab_break of
| ||||
|
| Set_tab
| ||||
|
| Close_tbox
| ||||
|
| Simple_break of
| ||||
|
| Break of
| ||||
|
| Flush of
| ||||
|
| Newline
| ||||
|
| If_newline
| ||||
|
| Deprecated of
| (* |
Escape hatch: a |
*) |
Base formatting instruction recognized by Format
type t
Immutable document type
type ('a, 'b) fmt = ('a, t, t, 'b) format4 type printer0 = t -> t
type 'a printer = 'a -> printer0
val empty : t
Empty document
val format : Format.formatter -> t -> unit
format ppf doc sends the format instruction of doc to the Format's formatter doc.
val fold : ('acc -> element -> 'acc) -> 'acc -> t -> 'acc
Fold over a document as a sequence of instructions
val msg : ('a, t) fmt -> 'a
Format_doc.Doc.msg and Format_doc.Doc.kmsg produce a document from a format string and its argument
val kmsg : (t -> 'b) -> ('a, 'b) fmt -> 'a val printf : ('a, printer0) fmt -> 'a
Format_doc.Doc.printf and Format_doc.Doc.kprintf produce a printer from a format string and its argument
val kprintf : (t -> 'b) -> ('a, t -> 'b) fmt -> 'a val open_box : box_type -> int -> printer0
The functions below mirror Format printers, without the pp_print_ prefix naming convention
val close_box : printer0
val text : string printer
val string : string printer
val bytes : bytes printer
val with_size : int printer
val int : int printer
val float : float printer
val char : char printer
val bool : bool printer
val space : printer0
val cut : printer0
val break : spaces:int -> indent:int -> printer0
val custom_break : fits:string * int * string -> breaks:string * int * string -> printer0
val force_newline : printer0
val if_newline : printer0
val flush : printer0
val force_stop : printer0
val open_tbox : printer0
val set_tab : printer0
val tab : printer0
val tab_break : width:int -> offset:int -> printer0
val close_tbox : printer0
val open_tag : stag printer
val close_tag : printer0
val list : ?sep:printer0 -> 'a printer -> 'a list printer
val iter : ?sep:printer0 -> iter:(('a -> unit) -> 'b -> unit) -> 'a printer -> 'b printer val array : ?sep:printer0 -> 'a printer -> 'a array printer
val seq : ?sep:printer0 -> 'a printer -> 'a Seq.t printer
val option : ?none:printer0 -> 'a printer -> 'a option printer
val result : ok:'a printer -> error:'e printer -> ('a, 'e) result printer val either : left:'a printer -> right:'b printer -> ('a, 'b) Either.t printer
© 1995-2024 INRIA.
https://ocaml.org/manual/5.3/api/compilerlibref/Format_doc.Doc.html