aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Utilities.ml
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--lib/Utilities.ml4
-rw-r--r--lib/Utilities.mli1
2 files changed, 5 insertions, 0 deletions
diff --git a/lib/Utilities.ml b/lib/Utilities.ml
index e4ee9c3..9bff69b 100644
--- a/lib/Utilities.ml
+++ b/lib/Utilities.ml
@@ -39,6 +39,10 @@ module List = struct
end
include Generic (ListSequence)
+
+ let hd_opt = function
+ | x::_ -> Some x
+ | [] -> None
end
module FingerTree = struct
diff --git a/lib/Utilities.mli b/lib/Utilities.mli
index f149889..eae59f9 100644
--- a/lib/Utilities.mli
+++ b/lib/Utilities.mli
@@ -11,6 +11,7 @@ end
module List : sig
val sequence : ('a, 'b) result list -> ('a list, 'b) result
+ val hd_opt : 'a list -> 'a option
end
module Option : sig