Module Pp


module Pp: sig .. end
Pretty printing.


This is a pretty printing library originally written by Christian Lindig and released as part of c-- project. The design of this library is discussed in the article "Strictly pretty".

The c-- README as follows: We want absolutely everyone to be able to use Quick C-- with confidence. To that end, the software is placed in the public domain. It is not protected by copyright, and it is not protected by a ``copyleft'' agreement like the one used by the Free Software Foundation.

The pretty printer provided by the Pp module is intended for tree-like structures. Documents are represented by an abstract type t. A document can be printed to a file or a string and during this process the pretty printer decides about the final outcome of the document. The only parameter it takes into account is the total line width and the number of characters a sub-document occupies.

A document of type t can be very small entity like a single word. Functions combine small documents to larger ones which then can be pretty printed.

type t 
val empty : t
val ($) : t -> t -> t
val text : string -> t
val break : t
val break_null : t
val break_with : string -> t
val nest : int -> t -> t
val hgrp : t -> t
val vgrp : t -> t
val agrp : t -> t
val fgrp : t -> t
val to_string : t -> string
val to_file : Pervasives.out_channel -> t -> unit
val to_string_width : int -> t -> string
val to_file_width : Pervasives.out_channel -> int -> t -> unit
val list : sep:t -> f:('a -> t) -> 'a list -> t
val commalist : f:('a -> t) -> 'a list -> t
val ($/) : t -> t -> t
val ($//) : t -> t -> t
val block : ?indent:int -> f:('a -> t) -> 'a list -> t
module Infix: sig .. end