aboutsummaryrefslogtreecommitdiffhomepage
path: root/clib/option.ml
diff options
context:
space:
mode:
Diffstat (limited to 'clib/option.ml')
-rw-r--r--clib/option.ml3
1 files changed, 3 insertions, 0 deletions
diff --git a/clib/option.ml b/clib/option.ml
index 21913e8f7..32fe2fc5f 100644
--- a/clib/option.ml
+++ b/clib/option.ml
@@ -52,6 +52,9 @@ let get = function
(** [make x] returns [Some x]. *)
let make x = Some x
+(** [bind x f] is [f y] if [x] is [Some y] and [None] otherwise *)
+let bind x f = match x with Some y -> f y | None -> None
+
(** [init b x] returns [Some x] if [b] is [true] and [None] otherwise. *)
let init b x =
if b then