add CCPair.to_string

This commit is contained in:
Fardale 2019-10-28 16:28:20 +01:00
parent 3dfbbeb3e3
commit f8bdceda14
2 changed files with 6 additions and 0 deletions

View file

@ -42,6 +42,8 @@ let compare f g (x1,y1) (x2,y2) =
let c = f x1 x2 in
if c <> 0 then c else g y1 y2
let to_string ?(sep=", ") a_to_string b_to_string (x,y) =
Printf.sprintf "%s%s%s" (a_to_string x) sep (b_to_string y)
type 'a printer = Format.formatter -> 'a -> unit

View file

@ -67,6 +67,10 @@ val equal : ('a -> 'a -> bool) -> ('b -> 'b -> bool) -> ('a * 'b) -> ('a * 'b) -
val compare : ('a -> 'a -> int) -> ('b -> 'b -> int) -> ('a * 'b) -> ('a * 'b) -> int
val to_string : ?sep:string -> ('a -> string) -> ('b -> string) -> ('a * 'b) -> string
(** Print tuple in a string
@since NEXT_RELEASE *)
type 'a printer = Format.formatter -> 'a -> unit
val pp : ?sep:string -> 'a printer -> 'b printer -> ('a * 'b) printer