diff options
| author | Estevan Castilho <tevo@riajuu.net> | 2026-09-19 01:08:28 +0000 |
|---|---|---|
| committer | Estevan Castilho <tevo@riajuu.net> | 2026-09-19 01:09:24 +0000 |
| commit | 2e2d7f6a9b116dac2fa20be657c916cb498c1508 (patch) | |
| tree | 94d39b1c49f69d1ca851e6e53b80297e603546bf /lib/Utilities.ml | |
| parent | c80121c23a90c60b9975e04a49d98c8dfb4866a1 (diff) | |
| download | RNT-2e2d7f6a9b116dac2fa20be657c916cb498c1508.tar.gz RNT-2e2d7f6a9b116dac2fa20be657c916cb498c1508.zip | |
Do not assume that the hash of an object is its storage address
Diffstat (limited to 'lib/Utilities.ml')
| -rw-r--r-- | lib/Utilities.ml | 13 |
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 |
