diff --git a/sequence.ml b/sequence.ml index b1d9ad4..fba9d0d 100644 --- a/sequence.ml +++ b/sequence.ml @@ -88,18 +88,14 @@ let concat s k = s (fun s' -> s' k) let flatten s = concat s -let flatMap f seq k = seq (fun x -> f x k) +let flat_map f seq k = seq (fun x -> f x k) -let flat_map = flatMap - -let fmap f seq k = +let filter_map f seq k = seq (fun x -> match f x with | None -> () | Some y -> k y ) -let filter_map = fmap - let intersperse elem seq k = let first = ref true in seq (fun x -> (if !first then first := false else k elem); k x) diff --git a/sequence.mli b/sequence.mli index 0cf036e..5fdb9bc 100644 --- a/sequence.mli +++ b/sequence.mli @@ -150,17 +150,11 @@ val concat : 'a t t -> 'a t val flatten : 'a t t -> 'a t (** Alias for {!concat} *) -val flatMap : ('a -> 'b t) -> 'a t -> 'b t -(** @deprecated use {!flat_map} since NEXT_RELEASE *) - val flat_map : ('a -> 'b t) -> 'a t -> 'b t (** Monadic bind. Intuitively, it applies the function to every element of the initial sequence, and calls {!concat}. @since 0.5 *) -val fmap : ('a -> 'b option) -> 'a t -> 'b t -(** @deprecated use {!filter_map} since NEXT_RELEASE *) - val filter_map : ('a -> 'b option) -> 'a t -> 'b t (** Map and only keep non-[None] elements @since 0.5 *) diff --git a/sequenceLabels.mli b/sequenceLabels.mli index b52ac74..ee6efae 100644 --- a/sequenceLabels.mli +++ b/sequenceLabels.mli @@ -126,17 +126,12 @@ val concat : 'a t t -> 'a t val flatten : 'a t t -> 'a t (** Alias for {!concat} *) -val flatMap : f:('a -> 'b t) -> 'a t -> 'b t -(** @deprecated use {!flat_map} *) - val flat_map : f:('a -> 'b t) -> 'a t -> 'b t -(** Alias to {!flatMap} with a more explicit name *) - -val fmap : f:('a -> 'b option) -> 'a t -> 'b t -(** @deprecated use {!filter_map} *) +(** Monadic bind. Intuitively, it applies the function to every + element of the initial sequence, and calls {!concat}. *) val filter_map : f:('a -> 'b option) -> 'a t -> 'b t -(** Alias to {!fmap} with a more explicit name *) +(** Map and only keep non-[None] elements *) val intersperse : x:'a -> 'a t -> 'a t (** Insert the single element between every element of the sequence *)