package b0

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Module Fmt.OCamlSource

Formatting OCaml literal values.

Sourceval unit : unit t

unit formats unit literals.

Sourceval bool : bool t

bool formats bool literals.

Sourceval int : int t

int formats int literals. Warning. Values formatted on a 64-bit platform may not parse on 32-bit platforms.

Sourceval int32 : int32 t

int32 formats signed int32 literals.

Sourceval uint32 : int32 t

uint32 formats unsigned int32 literals (i.e. as hexadecimal).

Sourceval int64 : int64 t

int64 formats signed int64 literals.

Sourceval uint64 : int64 t

uint64 formats unsigned int64 literals (i.e. as hexadecimal).

Sourceval nativeint : nativeint t

nativeint formats signed nativeint literals.

Sourceval nativeuint : nativeint t

nativeuint formats unsigned nativeint literals (i.e. as hexadecimal).

Sourceval float : float t

float formats float literals (using "%F").

Sourceval hex_float : float t

float formats hex float literals (using "%#F").

Chars and strings

FIXME. Can we make the string combinators multi line ?

Sourceval char : char t

char formats char literals as follows:

  • Char.Ascii.is_print except single quote and slash are printed verbatim.
  • Characters '\'', '\\', '\n', '\r' and '\t' are printed just as written here.
  • Other charactres use hex escapes '\xhh'.
Sourceval ascii_string : string t

ascii_string formats string literals using char, except that double quotes are escaped and single quotes are not.

Sourceval string : string t

string formats string literals. Assumes an UTF-8 encoded string but escapes:

  • Double quotes.
  • C0 control characters (U+0000-U+001F)
  • C1 control characters (U+0080-U+009F)
  • Line separator (U+2028) and paragraph separator (U+2029).
  • UTF-8 decode errors by hex escapes \xhh.
Sourceval binary_string : string t

binary_string formats binary string literals. All characters are formatted using \xhh escapes.

Parametric types

Note. Depending on what you print an enclosing parens may be due on the arguments.

Sourceval option : 'a t -> 'a option t

option formats option literals.

Sourceval either : left:'a t -> right:'b t -> ('a, 'b) Either.t t

either formats Either.t literals.

Sourceval result : ok:'a t -> error:'b t -> ('a, 'b) result t

result ~ok ~error formats result literals.

Sourceval list : 'a t -> 'a list t

list formats list literals.

Sourceval array : 'a t -> 'a array t

array formats array literals.

Sourceval pair : 'a t -> 'b t -> ('a * 'b) t

pair formats pair literals.

Sourceval t2 : 'a t -> 'b t -> ('a * 'b) t

t2 is pair.

Sourceval t3 : 'a t -> 'b t -> 'c t -> ('a * 'b * 'c) t

t3 formats triples.

Sourceval t4 : 'a t -> 'b t -> 'c t -> 'd t -> ('a * 'b * 'c * 'd) t

t4 formats quadruples.

Sourceval t5 : 'a t -> 'b t -> 'c t -> 'd t -> 'e t -> ('a * 'b * 'c * 'd * 'e) t

t5 formats quintuplets.

Sourceval t6 : 'a t -> 'b t -> 'c t -> 'd t -> 'e t -> 'f t -> ('a * 'b * 'c * 'd * 'e * 'f) t

t6 formats sextuplets.