[sledge] Add Option.flat_map

Reviewed By: jvillard

Differential Revision: D25146161

fbshipit-source-id: a8d60de12
master
Josh Berdine 4 years ago committed by Facebook GitHub Bot
parent 2b89fa531a
commit c063a91c7c

@ -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

@ -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

Loading…
Cancel
Save