aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Utilities.ml
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--lib/Utilities.ml6
-rw-r--r--lib/Utilities.mli6
2 files changed, 12 insertions, 0 deletions
diff --git a/lib/Utilities.ml b/lib/Utilities.ml
index 0a5bd9d..a96d16f 100644
--- a/lib/Utilities.ml
+++ b/lib/Utilities.ml
@@ -1,3 +1,9 @@
+module Ordering = struct
+ type t = Equal | Smaller | Greater
+
+ let of_int x = if x < 0 then Smaller else if x > 0 then Greater else Equal
+end
+
module Result = struct
let ( let* ) = Result.bind
let fmap f m = Result.bind m f
diff --git a/lib/Utilities.mli b/lib/Utilities.mli
index 34a03e9..f9c0c29 100644
--- a/lib/Utilities.mli
+++ b/lib/Utilities.mli
@@ -1,3 +1,9 @@
+module Ordering : sig
+ type t = Equal | Smaller | Greater
+
+ val of_int : int -> t
+end
+
module Result : sig
val ( let* ) : ('a, 'e) result -> ('a -> ('b, 'e) result) -> ('b, 'e) result
val fmap : ('a -> ('b, 'e) result) -> ('a, 'e) result -> ('b, 'e) result