diff --git a/sledge/nonstdlib/option.ml b/sledge/nonstdlib/option.ml index dce244872..60c96364b 100644 --- a/sledge/nonstdlib/option.ml +++ b/sledge/nonstdlib/option.ml @@ -16,6 +16,7 @@ let pp fmt pp_elt fs = function | None -> () let map_or xo ~default ~f = map_or ~default f xo +let flat_map xo ~f = flat_map f xo let iter xo ~f = iter f xo let exists xo ~f = exists f xo let for_all xo ~f = for_all f xo diff --git a/sledge/nonstdlib/option.mli b/sledge/nonstdlib/option.mli index 8c12075bc..e4d08d032 100644 --- a/sledge/nonstdlib/option.mli +++ b/sledge/nonstdlib/option.mli @@ -17,6 +17,7 @@ include Monad_intf.S with type 'a t := 'a t val pp : ('a_pp -> 'a -> unit, unit) fmt -> 'a_pp -> 'a option pp val map_or : 'a t -> default:'b -> f:('a -> 'b) -> 'b +val flat_map : 'a t -> f:('a -> 'b t) -> 'b t val iter : 'a t -> f:('a -> unit) -> unit val exists : 'a t -> f:('a -> bool) -> bool val for_all : 'a t -> f:('a -> bool) -> bool