package pprint

  1. Overview
  2. Docs
A pretty-printing combinator library and rendering engine

Install

Dune Dependency

Authors

Maintainers

Sources

20200410.tar.gz
md5=d6b20d1db73cf15f79b2884a9e38bf06
sha512=f9a4ea908248cc14df1ef93418ce80598e88666b9347f683d5cc6f67a8c28290f0a4e40ae6f1842efa1d9c38d4802e7e3c77bbcf2e6f986c45ba12907e9580c9

doc/pprint/PPrintOCaml/index.html

Module PPrintOCamlSource

A set of functions that construct representations of OCaml values.

The string representations produced by these functions are supposed to be accepted by the OCaml parser as valid values.

The signature of this module is compatible with that expected by the camlp4 generator Camlp4RepresentationGenerator.

These functions do not distinguish between mutable and immutable values. They do not recognize sharing, and do not incorporate a protection against cyclic values.

Sourcetype constructor = string
Sourcetype type_name = string
Sourcetype record_field = string
Sourcetype tag = int
Sourcetype representation = PPrintEngine.document

A representation of a value is a PPrint document.

variant _ dc _ args is a description of a constructed value whose data constructor is dc and whose arguments are args. The other two parameters are presently unused.

record _ fields is a description of a record value whose fields are fields. The other parameter is presently unused.

tuple args is a description of a tuple value whose components are args.

Sourceval string : string -> representation

string s is a representation of the string s.

Sourceval int : int -> representation

int i is a representation of the integer i.

Sourceval int32 : int32 -> representation

int32 i is a representation of the 32-bit integer i.

Sourceval int64 : int64 -> representation

int64 i is a representation of the 64-bit integer i.

Sourceval nativeint : nativeint -> representation

nativeint i is a representation of the native integer i.

Sourceval float : float -> representation

float f is a representation of the floating-point number f.

Sourceval char : char -> representation

char c is a representation of the character c.

Sourceval bool : bool -> representation

bool b is a representation of the Boolenan value b.

Sourceval option : ('a -> representation) -> 'a option -> representation

option f o is a representation of the option o, where the representation of the element, if present, is computed by the function f.

Sourceval list : ('a -> representation) -> 'a list -> representation

list f xs is a representation of the list xs, where the representation of each element is computed by the function f. If the whole list fits on a single line, then it is printed on a single line; otherwise each element is printed on a separate line.

Sourceval flowing_list : ('a -> representation) -> 'a list -> representation

flowing_list f xs is a representation of the list xs, where the representation of each element is computed by the function f. As many elements are possible are printed on each line.

Sourceval array : ('a -> representation) -> 'a array -> representation

array f xs is a representation of the array xs, where the representation of each element is computed by the function f. If the whole array fits on a single line, then it is printed on a single line; otherwise each element is printed on a separate line.

Sourceval flowing_array : ('a -> representation) -> 'a array -> representation

flowing_array f xs is a representation of the array xs, where the representation of each element is computed by the function f. As many elements are possible are printed on each line.

Sourceval ref : ('a -> representation) -> 'a ref -> representation

ref r is a representation of the reference r, where the representation of the content is computed by the function f.

Sourceval unknown : type_name -> 'a -> representation

unknown t _ is a representation of an unknown value of type t.

OCaml

Innovation. Community. Security.