aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Utilities.ml
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Utilities.ml')
-rw-r--r--lib/Utilities.ml13
1 files changed, 8 insertions, 5 deletions
diff --git a/lib/Utilities.ml b/lib/Utilities.ml
index 9bff69b..404d8aa 100644
--- a/lib/Utilities.ml
+++ b/lib/Utilities.ml
@@ -4,6 +4,14 @@ module Ordering = struct
let of_int x = if x < 0 then Smaller else if x > 0 then Greater else Equal
end
+module Option = struct
+ let ( let* ) = Option.bind
+ let fmap f m = Option.bind m f
+ let sequence = function
+ | None -> Ok None
+ | Some x -> Result.map Option.some x
+end
+
module Result = struct
let ( let* ) = Result.bind
let fmap f m = Result.bind m f
@@ -80,11 +88,6 @@ module FingerTree = struct
|> Fun.flip BatIO.to_string ss
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