From 7e5161f94ff9ef0d34fb73264283b10f91f5e616 Mon Sep 17 00:00:00 2001 From: Simon Cruanes Date: Sun, 24 May 2015 21:36:48 +0200 Subject: [PATCH] add `CCOpt.is_none` --- src/core/CCOpt.ml | 4 ++++ src/core/CCOpt.mli | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/core/CCOpt.ml b/src/core/CCOpt.ml index 6f17e981..9a792fd0 100644 --- a/src/core/CCOpt.ml +++ b/src/core/CCOpt.ml @@ -40,6 +40,10 @@ let is_some = function | None -> false | Some _ -> true +let is_none = function + | None -> true + | Some _ -> false + let compare f o1 o2 = match o1, o2 with | None, None -> 0 | Some _, None -> 1 diff --git a/src/core/CCOpt.mli b/src/core/CCOpt.mli index f3214310..09ffb8ae 100644 --- a/src/core/CCOpt.mli +++ b/src/core/CCOpt.mli @@ -36,6 +36,9 @@ val maybe : ('a -> 'b) -> 'b -> 'a t -> 'b val is_some : _ t -> bool +val is_none : _ t -> bool +(** @since NEXT_RELEASE *) + val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int val equal : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool @@ -62,7 +65,6 @@ val fold : ('a -> 'b -> 'a) -> 'a -> 'b t -> 'a val filter : ('a -> bool) -> 'a t -> 'a t (** Filter on 0 or 1 elements - @since 0.5 *) val get : 'a -> 'a t -> 'a