package containers

  1. Overview
  2. Docs

Helpers for Format

  • since 0.8
type 'a sequence = ('a -> unit) -> unit
type 'a printer = t -> 'a -> unit

Combinators

val silent : 'a printer

prints nothing

val unit : unit printer
val int : int printer
val string : string printer
val bool : bool printer
val float3 : float printer
val float : float printer
val list : ?start:string -> ?stop:string -> ?sep:string -> 'a printer -> 'a list printer
val array : ?start:string -> ?stop:string -> ?sep:string -> 'a printer -> 'a array printer
val arrayi : ?start:string -> ?stop:string -> ?sep:string -> (int * 'a) printer -> 'a array printer
val seq : ?start:string -> ?stop:string -> ?sep:string -> 'a printer -> 'a sequence printer
val opt : 'a printer -> 'a option printer
val pair : 'a printer -> 'b printer -> ('a * 'b) printer
val triple : 'a printer -> 'b printer -> 'c printer -> ('a * 'b * 'c) printer
val quad : 'a printer -> 'b printer -> 'c printer -> 'd printer -> ('a * 'b * 'c * 'd) printer
val map : ('a -> 'b) -> 'b printer -> 'a printer

IO

val output : t -> 'a printer -> 'a -> unit
val to_string : 'a printer -> 'a -> string
val stdout : t
val stderr : t
val sprintf : ('a, t, unit, string) Pervasives.format4 -> 'a

print into a string

val to_file : string -> ('a, t, unit, unit) Pervasives.format4 -> 'a

Print to the given file

OCaml

Innovation. Community. Security.