add CCOpt.print

This commit is contained in:
Simon Cruanes 2015-09-02 21:05:17 +02:00
parent 8f59e8e193
commit 3d7035e84f
2 changed files with 10 additions and 0 deletions

View file

@ -147,6 +147,7 @@ let of_list = function
type 'a sequence = ('a -> unit) -> unit
type 'a gen = unit -> 'a option
type 'a printer = Buffer.t -> 'a -> unit
type 'a fmt = Format.formatter -> 'a -> unit
type 'a random_gen = Random.State.t -> 'a
let random g st =
@ -166,3 +167,8 @@ let to_seq o k = match o with
let pp ppx buf o = match o with
| None -> Buffer.add_string buf "None"
| 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

View file

@ -121,6 +121,7 @@ val of_list : 'a list -> 'a t
type 'a sequence = ('a -> unit) -> unit
type 'a gen = unit -> 'a option
type 'a printer = Buffer.t -> 'a -> unit
type 'a fmt = Format.formatter -> 'a -> unit
type 'a random_gen = Random.State.t -> 'a
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 print : 'a fmt -> 'a t fmt
(** @since NEXT_RELEASE *)