From 570744638ab4b08286562c0f4d45a7928ed008b0 Mon Sep 17 00:00:00 2001 From: Pierre Courtieu Date: Fri, 22 Jan 2021 14:45:08 +0100 Subject: Fix #13739 - disable some warnings when calling Function. Also added a generic way of temporarily disabling a warning. Also added try_finalize un lib/utils.ml. --- lib/util.mli | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'lib/util.mli') diff --git a/lib/util.mli b/lib/util.mli index fe34525671..aefb015c38 100644 --- a/lib/util.mli +++ b/lib/util.mli @@ -112,6 +112,15 @@ type 'a delayed = unit -> 'a val delayed_force : 'a delayed -> 'a +(** [try_finally f x g y] applies the main code [f] to [x] and + returns the result after having applied the finalization + code [g] to [y]. If the main code raises the exception + [exn], the finalization code is executed and [exn] is raised. + If the finalization code itself fails, the exception + returned is always the one from the finalization code. + Credit X.Leroy, D.Remy. *) +val try_finally: ('a -> 'b) -> 'a -> ('c -> unit) -> 'c -> 'b + (** {6 Enriched exceptions} *) type iexn = Exninfo.iexn -- cgit v1.2.3