mirror of
https://github.com/c-cube/iter.git
synced 2025-12-06 11:15:32 -05:00
remove deprecated flatMap and fmap
This commit is contained in:
parent
8a2c32d729
commit
b8894cd3ec
3 changed files with 5 additions and 20 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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 *)
|
||||
|
|
|
|||
|
|
@ -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 *)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue