From fb6483539eb5121d2c51593f491fb0de7e7950ad Mon Sep 17 00:00:00 2001 From: Simon Cruanes Date: Sat, 7 Mar 2020 11:26:00 -0600 Subject: [PATCH] feat(fmt): add `exn` combinator --- src/core/CCFormat.ml | 2 ++ src/core/CCFormat.mli | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/src/core/CCFormat.ml b/src/core/CCFormat.ml index e1ff197a..a4ac12f0 100644 --- a/src/core/CCFormat.ml +++ b/src/core/CCFormat.ml @@ -127,6 +127,8 @@ let hbox pp out x = let of_to_string f out x = Format.pp_print_string out (f x) +let exn = of_to_string Printexc.to_string + let const pp x out () = pp out x let some pp out = function diff --git a/src/core/CCFormat.mli b/src/core/CCFormat.mli index 3fdb0b27..f4a0198f 100644 --- a/src/core/CCFormat.mli +++ b/src/core/CCFormat.mli @@ -29,6 +29,10 @@ val bool : bool printer val float3 : float printer (* 3 digits after . *) val float : float printer +val exn : exn printer +(** Printer using {!Printexc.to_string}. + @since NEXT_RELEASE *) + val newline : unit printer (** Force newline (see {!Format.pp_force_newline}). @since 1.2 *)