package merlin-lib

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Module Format_doc.DocSource

Definitions and immutable API for composing documents

Type definitions and core functions

Sourcetype box_type =
  1. | H
  2. | V
  3. | HV
  4. | HoV
  5. | B

Format box types

Sourcetype stag = Format.stag
Sourcetype element =
  1. | Text of string
  2. | With_size of int
  3. | Open_box of {
    1. kind : box_type;
    2. indent : int;
    }
  4. | Close_box
  5. | Open_tag of Format.stag
  6. | Close_tag
  7. | Open_tbox
  8. | Tab_break of {
    1. width : int;
    2. offset : int;
    }
  9. | Set_tab
  10. | Close_tbox
  11. | Simple_break of {
    1. spaces : int;
    2. indent : int;
    }
  12. | Break of {
    1. fits : (string * int * string) as 'a;
    2. breaks : 'a;
    }
  13. | Flush of {
    1. newline : bool;
    }
  14. | Newline
  15. | If_newline
  16. | 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 Format

Sourcetype t

Immutable document type

Sourcetype ('a, 'b) fmt = ('a, t, t, 'b) format4
Sourcetype printer0 = t -> t
Sourcetype 'a printer = 'a -> printer0
Sourceval empty : t

Empty document

Sourceval format : Format.formatter -> t -> unit

format ppf doc sends the format instruction of doc to the Format's formatter doc.

Sourceval fold : ('acc -> element -> 'acc) -> 'acc -> t -> 'acc

Fold over a document as a sequence of instructions

Sourceval msg : ('a, t) fmt -> 'a

msg and kmsg produce a document from a format string and its argument

Sourceval kmsg : (t -> 'b) -> ('a, 'b) fmt -> 'a
Sourceval printf : ('a, printer0) fmt -> 'a

printf and kprintf produce a printer from a format string and its argument

Sourceval kprintf : (t -> 'b) -> ('a, t -> 'b) fmt -> 'a
Sourceval open_box : box_type -> int -> printer0

The functions below mirror Format printers, without the pp_print_ prefix naming convention

Sourceval close_box : printer0
Sourceval text : string printer
Sourceval string : string printer
Sourceval bytes : bytes printer
Sourceval with_size : int printer
Sourceval int : int printer
Sourceval float : float printer
Sourceval char : char printer
Sourceval bool : bool printer
Sourceval space : printer0
Sourceval cut : printer0
Sourceval break : spaces:int -> indent:int -> printer0
Sourceval custom_break : fits:(string * int * string) as 'a -> breaks:'a -> printer0
Sourceval force_newline : printer0
Sourceval if_newline : printer0
Sourceval flush : printer0
Sourceval force_stop : printer0
Sourceval open_tbox : printer0
Sourceval set_tab : printer0
Sourceval tab : printer0
Sourceval tab_break : width:int -> offset:int -> printer0
Sourceval close_tbox : printer0
Sourceval open_tag : stag printer
Sourceval close_tag : printer0
Sourceval list : ?sep:printer0 -> 'a printer -> 'a list printer
Sourceval iter : ?sep:printer0 -> iter:(('a -> unit) -> 'b -> unit) -> 'a printer -> 'b printer
Sourceval array : ?sep:printer0 -> 'a printer -> 'a array printer
Sourceval seq : ?sep:printer0 -> 'a printer -> 'a Seq.t printer
Sourceval option : ?none:printer0 -> 'a printer -> 'a option printer
Sourceval result : ok:'a printer -> error:'e printer -> ('a, 'e) result printer
Sourceval either : left:'a printer -> right:'b printer -> ('a, 'b) Either.t printer
OCaml

Innovation. Community. Security.