CCPair.print

This commit is contained in:
Simon Cruanes 2014-09-16 22:11:42 +02:00
parent 67824b333a
commit 25139d7bb5
2 changed files with 7 additions and 0 deletions

View file

@ -64,6 +64,10 @@ let compare f g (x1,y1) (x2,y2) =
if c <> 0 then c else g y1 y2
type 'a printer = Buffer.t -> 'a -> unit
type 'a formatter = Format.formatter -> 'a -> unit
let pp pp_x pp_y buf (x,y) =
Printf.bprintf buf "(%a, %a)" pp_x x pp_y y
let print pa pb fmt (x,y) =
Format.fprintf fmt "(%a, %a)" pa x pb y

View file

@ -83,5 +83,8 @@ 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
type 'a printer = Buffer.t -> 'a -> unit
type 'a formatter = Format.formatter -> 'a -> unit
val pp : 'a printer -> 'b printer -> ('a*'b) printer
val print : 'a formatter -> 'b formatter -> ('a*'b) formatter