package ostap

  1. Overview
  2. Docs

Pretty --- a general set of pretty-printer combinators. Implemented as a wrapper for the standard module Format to ease its use.

type printer = Format.formatter -> unit

Printer type.

val toString : printer -> string

String conversion.

val empty : printer

Empty printer.

val newline : printer

Newline printer.

val break : printer

Break printer (prints a logical break, see standard module Format).

val box : printer

Opens box (see standard module Format).

val vbox : printer

Opens vertical box (see standard module Format).

val hbox : printer

Opens horizontal box (see standard module Format).

val hovbox : printer

Opens horizontal/vertical box (see standard module Format).

val hvbox : printer

Opens horizontal and vertical box (see standard module Format).

val endbox : printer

Closes box (see standard module Format).

val string : string -> printer

string str makes printer which prints str.

val int : int -> printer

int n makes printer of int.

val char : char -> printer

char c makes printer of char.

val bool : bool -> printer

bool b makes printer of bool.

val float : float -> printer

float f makes printer of float.

val seq : printer list -> printer

List printing combinator.

val seqa : printer array -> printer

Array printing combinator.

val listBy : printer -> printer list -> printer

listBy del list prints elements of list delimited by del.

val listAllBy : printer -> printer list -> printer

listAllBy del list prints elements of list delimited by del. Empty elements still cause printing delimiters before them

val arrayBy : printer -> printer array -> printer

arrayBy del array prints elements of array delimited by del.

val arrayAllBy : printer -> printer array -> printer

arrayAllBy del array prints elements of array delimited by del. Empty elements still cause printing delimiters before them

val listBySemicolon : printer list -> printer

A synonym for listBy (string "; ").

val listByComma : printer list -> printer

A synonym for listBy (string ", ").

val listBySpace : printer list -> printer

A synonym for listBy (string " ").

val listBySemicolonBreak : printer list -> printer

A synonym for listBy (seq [string "; "; break]).

val listByCommaBreak : printer list -> printer

A synonym for listBy (seq [string ", "; break]).

val listBySpaceBreak : printer list -> printer

A synonym for listBy (seq [string " "; break]).

val listByBreak : printer list -> printer

A synonym for listBy break.

val arrayBySemicolon : printer array -> printer

A synonym for arrayBy (string "; ").

val arrayByComma : printer array -> printer

A synonym for arrayBy (string ", ").

val arrayBySpace : printer array -> printer

A synonym for arrayBy (string " ").

val arrayBySemicolonBreak : printer array -> printer

A synonym for arrayBy (seq [string "; "; break]).

val arrayByCommaBreak : printer array -> printer

A synonym for arrayBy (seq [string ", "; break]).

val arrayBySpaceBreak : printer array -> printer

A synonym for arrayBy (seq [string " "; break]).

val arrayByBreak : printer array -> printer

A synonym for arrayBy break.

Shortcuts for boxed formatting

val boxed : printer -> printer

Prints its argument within box (see standard module Format).

val hboxed : printer -> printer

Prints its argument within hbox (see standard module Format).

val vboxed : printer -> printer

Prints its argument within vbox (see standard module Format).

val hovboxed : printer -> printer

Prints its argument within hovbox (see standard module Format).

val hvboxed : printer -> printer

Prints its argument within hvbox (see standard module Format).

val block : printer -> printer -> printer -> printer

block o c b prints b as a contents of block with opening o and closing c.

val plock : printer -> printer -> printer

plock o b prints b as a contents of prefixed block with opening o.

val brboxed : printer -> printer -> printer -> printer

brboxed left right p surrounds p by "brackets" left and right.

val rboxed : printer -> printer

Synonym for brboxed (string "(") (string ")").

val sboxed : printer -> printer

Synonym for brboxed (string "[") (string "]").

val cboxed : printer -> printer

Synonym for brboxed (string "{") (string "}").

OCaml

Innovation. Community. Security.