package pprint

  1. Overview
  2. Docs
method requirement : requirement

A custom document must publish the width (i.e., the number of columns) that it would like to occupy if it is printed on a single line (that is, in flattening mode). The special value infinity means that this document cannot be printed on a single line; this value causes any groups that contain this document to be dissolved. This method should in principle work in constant time.

method pretty : output -> state -> int -> bool -> unit

The method pretty is used by the main rendering algorithm. It has access to the output channel and to the algorithm's internal state, as described above. In addition, it receives the current indentation level and the current flattening mode (on or off). If flattening mode is on, then the document must be printed on a single line, in a manner that is consistent with the requirement that was published ahead of time. If flattening mode is off, then there is no such obligation. The state must be updated in a manner that is consistent with what is sent to the output channel.

method compact : output -> unit

The method compact is used by the compact rendering algorithm. It has access to the output channel only.

OCaml

Innovation. Community. Security.