aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Utilities.ml
diff options
context:
space:
mode:
authorEstevan Castilho <tevo@riajuu.net>2026-08-22 23:22:45 +0000
committerEstevan Castilho <tevo@riajuu.net>2026-08-23 03:07:01 +0000
commit11e41f1179f870d25ed6621d488a8dca2d7005c2 (patch)
tree4faa768ea7961ecdfd8fb991d55d41f85677a15d /lib/Utilities.ml
parent9ef2323823c8fea8cfb53e9c011433daeb7ec66f (diff)
downloadRNT-11e41f1179f870d25ed6621d488a8dca2d7005c2.tar.gz
RNT-11e41f1179f870d25ed6621d488a8dca2d7005c2.zip
Lifecycles and namespaces
Diffstat (limited to '')
-rw-r--r--lib/Utilities.ml5
-rw-r--r--lib/Utilities.mli5
2 files changed, 10 insertions, 0 deletions
diff --git a/lib/Utilities.ml b/lib/Utilities.ml
index a96d16f..52483b3 100644
--- a/lib/Utilities.ml
+++ b/lib/Utilities.ml
@@ -17,6 +17,11 @@ module Result = struct
(Ok [])
end
+module Option = struct
+ let ( let* ) = Option.bind
+ let fmap f m = Option.bind m f
+end
+
module Atomic = struct
let rec swap atom f =
let v = Atomic.get atom in
diff --git a/lib/Utilities.mli b/lib/Utilities.mli
index f9c0c29..9661796 100644
--- a/lib/Utilities.mli
+++ b/lib/Utilities.mli
@@ -10,6 +10,11 @@ module Result : sig
val sequence : ('a, 'b) result list -> ('a list, 'b) result
end
+module Option : sig
+ val ( let* ) : 'a option -> ('a -> 'b option) -> 'b option
+ val fmap : ('a -> 'b option) -> 'a option -> 'b option
+end
+
module Atomic : sig
val swap : 'a Atomic.t -> ('a -> 'a) -> 'a Atomic.t
(* This is silly *)