mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2025-12-07 11:45:31 -05:00
add CCOpt.print
This commit is contained in:
parent
8f59e8e193
commit
3d7035e84f
2 changed files with 10 additions and 0 deletions
|
|
@ -147,6 +147,7 @@ let of_list = function
|
||||||
type 'a sequence = ('a -> unit) -> unit
|
type 'a sequence = ('a -> unit) -> unit
|
||||||
type 'a gen = unit -> 'a option
|
type 'a gen = unit -> 'a option
|
||||||
type 'a printer = Buffer.t -> 'a -> unit
|
type 'a printer = Buffer.t -> 'a -> unit
|
||||||
|
type 'a fmt = Format.formatter -> 'a -> unit
|
||||||
type 'a random_gen = Random.State.t -> 'a
|
type 'a random_gen = Random.State.t -> 'a
|
||||||
|
|
||||||
let random g st =
|
let random g st =
|
||||||
|
|
@ -166,3 +167,8 @@ let to_seq o k = match o with
|
||||||
let pp ppx buf o = match o with
|
let pp ppx buf o = match o with
|
||||||
| None -> Buffer.add_string buf "None"
|
| None -> Buffer.add_string buf "None"
|
||||||
| Some x -> Buffer.add_string buf "Some "; ppx buf x
|
| Some x -> Buffer.add_string buf "Some "; ppx buf x
|
||||||
|
|
||||||
|
let print ppx out = function
|
||||||
|
| None -> Format.pp_print_string out "None"
|
||||||
|
| Some x -> Format.fprintf out "@[Some %a@]" ppx x
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -121,6 +121,7 @@ val of_list : 'a list -> 'a t
|
||||||
type 'a sequence = ('a -> unit) -> unit
|
type 'a sequence = ('a -> unit) -> unit
|
||||||
type 'a gen = unit -> 'a option
|
type 'a gen = unit -> 'a option
|
||||||
type 'a printer = Buffer.t -> 'a -> unit
|
type 'a printer = Buffer.t -> 'a -> unit
|
||||||
|
type 'a fmt = Format.formatter -> 'a -> unit
|
||||||
type 'a random_gen = Random.State.t -> 'a
|
type 'a random_gen = Random.State.t -> 'a
|
||||||
|
|
||||||
val random : 'a random_gen -> 'a t random_gen
|
val random : 'a random_gen -> 'a t random_gen
|
||||||
|
|
@ -130,3 +131,6 @@ val to_seq : 'a t -> 'a sequence
|
||||||
|
|
||||||
val pp : 'a printer -> 'a t printer
|
val pp : 'a printer -> 'a t printer
|
||||||
|
|
||||||
|
val print : 'a fmt -> 'a t fmt
|
||||||
|
(** @since NEXT_RELEASE *)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue