Parameter MakeCompat.C

The cost factory interface.

A valid cost factory should also satisfy the following contracts.

See default_cost_factory, the cost factory section, and the paper for examples of cost factories.

type t

A type for cost

val text : int -> int -> t

text c l calculates a cost for a text placement at column position c with length l

val newline : int -> t

newline i calculates a cost for a newline and indentation at level i

val combine : t -> t -> t

combine x y combines the costs x and y together

val le : t -> t -> bool

le x y tests if the cost x is less than or equal to the cost y.

val two_columns_bias : int -> t

two_columns_bias i is the bias cost, added to each possible column separator so that the leftmost column separator is preferred.

val two_columns_overflow : int -> t

two_columns_overflow i is the cost due to exceeding the column separator. Make this cost greater than the usual overflow cost (for exceeding the page width limit) to prefer going over the page width limit instead of going over the column separator.

val limit : int
val string_of_cost : t -> string

string_of_cost c produces a string representation of a cost c

val debug_format : string -> bool -> string -> string

debug_format s is_tainted cost produces a debugging string from the output of the core printer.