package prettiest

  1. Overview
  2. Docs
type t

The type of documents.

include Width
val width : int
val text : string -> t

Turn a string without newlines into a document.

val flush : t -> t

Add newline.

val hcat : t list -> t

Concatenate documents horisontally without extra spacing.

val hsep : t list -> t

Concatenate documents horisontally with one space between each.

val vcat : t list -> t

Concatenate documents vertically.

val render : t -> string option

Render document. Returns None if the document does not fit.

val choice : t list -> t

Allow the printer to choose which of the given document to render. Choices must be semantically equivalent.

val fail : t

Unit for the choice function.

val empty : t

The empty document.

val nest : int -> t -> t

Indent the given document any number of spaces.

val sep : t list -> t

Either concatenate document with hsep or vcat

val intersperse : sep:t -> t list -> t list

Append sep to every element except the last.

val intersperse_map : f:('a -> t) -> sep:t -> 'a list -> t list

Same as intersperse but map f across elements at the same time.

module Infix : sig ... end
module Characters : sig ... end
OCaml

Innovation. Community. Security.