aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/flags.mli
diff options
context:
space:
mode:
authorGravatar Emilio Jesus Gallego Arias <e+git@x80.org>2017-11-19 04:47:15 +0100
committerGravatar Emilio Jesus Gallego Arias <e+git@x80.org>2017-11-19 04:51:49 +0100
commita554519874c15d0a790082e5f15f3dc2419c6c38 (patch)
treefbca74c97943685e93e10b85de708cc7c54a7abe /lib/flags.mli
parentedf1a8f36f75861b822081b3825357e122b6937d (diff)
[lib] Minor pending cleanup to consolidate helper function.
While we are at it we refactor a few special cases of the helper.
Diffstat (limited to 'lib/flags.mli')
-rw-r--r--lib/flags.mli9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/flags.mli b/lib/flags.mli
index 0ff3e0a81..c4afb8318 100644
--- a/lib/flags.mli
+++ b/lib/flags.mli
@@ -110,6 +110,15 @@ val warn : bool ref
val make_warn : bool -> unit
val if_warn : ('a -> unit) -> 'a -> unit
+(** [with_modified_ref r nf f x] Temporarily modify a reference in the
+ call to [f x] . Be very careful with these functions, it is very
+ easy to fall in the typical problem with effects:
+
+ with_modified_ref r nf f x y != with_modified_ref r nf (f x) y
+
+*)
+val with_modified_ref : 'c ref -> ('c -> 'c) -> ('a -> 'b) -> 'a -> 'b
+
(** Temporarily activate an option (to activate option [o] on [f x y z],
use [with_option o (f x y) z]) *)
val with_option : bool ref -> ('a -> 'b) -> 'a -> 'b