Module Doc
: sigend
Definitions and immutable API for composing documents
Typedefinitionsandcorefunctionstypebox_type =
| H
| V
| HV
| HoV
| B
Format box types
typestag = Format.stagtypeelement =
| Text ofstring
| With_size ofint
| Open_box of{
kind : box_type ;
indent : int ;
}
| Close_box
| Open_tag ofFormat.stag
| Close_tag
| Open_tbox
| Tab_break of{
width : int ;
offset : int ;
}
| Set_tab
| Close_tbox
| Simple_break of{
spaces : int ;
indent : int ;
}
| Break of{
fits : string*int*string ;
breaks : string*int*string ;
}
| Flush of{
newline : bool ;
}
| Newline
| If_newline
| Deprecated of(Format.formatter->unit)
(* Escape hatch: a Format printer used to provide backward-compatibility for user-defined printer (from
the #install_printer toplevel directive for instance).
*)
Base formatting instruction recognized by Formattypet
Immutable document type
type('a,'b)fmt = ('a,t,t,'b)format4typeprinter0 = t->ttype'aprinter = 'a->printer0valempty : t
Empty document
valformat : Format.formatter->t->unitformatppfdoc sends the format instruction of doc to the Format's formatter doc .
valfold : ('acc->element->'acc)->'acc->t->'acc
Fold over a document as a sequence of instructions
valmsg : ('a,t)fmt->'aFormat_doc.Doc.msg and Format_doc.Doc.kmsg produce a document from a format string and its argument
valkmsg : (t->'b)->('a,'b)fmt->'avalprintf : ('a,printer0)fmt->'aFormat_doc.Doc.printf and Format_doc.Doc.kprintf produce a printer from a format string and its argument
valkprintf : (t->'b)->('a,t->'b)fmt->'avalopen_box : box_type->int->printer0
The functions below mirror Format printers, without the pp_print_ prefix naming convention
valclose_box : printer0valtext : stringprintervalstring : stringprintervalbytes : bytesprintervalwith_size : intprintervalint : intprintervalfloat : floatprintervalchar : charprintervalbool : boolprintervalspace : printer0valcut : printer0valbreak : spaces:int->indent:int->printer0valcustom_break : fits:string*int*string->breaks:string*int*string->printer0valforce_newline : printer0valif_newline : printer0valflush : printer0valforce_stop : printer0valopen_tbox : printer0valset_tab : printer0valtab : printer0valtab_break : width:int->offset:int->printer0valclose_tbox : printer0valopen_tag : stagprintervalclose_tag : printer0vallist : ?sep:printer0->'aprinter->'alistprintervaliter : ?sep:printer0->iter:(('a->unit)->'b->unit)->'aprinter->'bprintervalarray : ?sep:printer0->'aprinter->'aarrayprintervalseq : ?sep:printer0->'aprinter->'aSeq.tprintervaloption : ?none:printer0->'aprinter->'aoptionprintervalresult : ok:'aprinter->error:'eprinter->('a,'e)resultprintervaleither : left:'aprinter->right:'bprinter->('a,'b)Either.tprinter
OCamldoc 2025-06-12 Format_doc.Doc(3o)