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 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 filter_map f seq k =
|
||||||
|
|
||||||
let fmap f seq k =
|
|
||||||
seq (fun x -> match f x with
|
seq (fun x -> match f x with
|
||||||
| None -> ()
|
| None -> ()
|
||||||
| Some y -> k y
|
| Some y -> k y
|
||||||
)
|
)
|
||||||
|
|
||||||
let filter_map = fmap
|
|
||||||
|
|
||||||
let intersperse elem seq k =
|
let intersperse elem seq k =
|
||||||
let first = ref true in
|
let first = ref true in
|
||||||
seq (fun x -> (if !first then first := false else k elem); k x)
|
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
|
val flatten : 'a t t -> 'a t
|
||||||
(** Alias for {!concat} *)
|
(** 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
|
val flat_map : ('a -> 'b t) -> 'a t -> 'b t
|
||||||
(** Monadic bind. Intuitively, it applies the function to every
|
(** Monadic bind. Intuitively, it applies the function to every
|
||||||
element of the initial sequence, and calls {!concat}.
|
element of the initial sequence, and calls {!concat}.
|
||||||
@since 0.5 *)
|
@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
|
val filter_map : ('a -> 'b option) -> 'a t -> 'b t
|
||||||
(** Map and only keep non-[None] elements
|
(** Map and only keep non-[None] elements
|
||||||
@since 0.5 *)
|
@since 0.5 *)
|
||||||
|
|
|
||||||
|
|
@ -126,17 +126,12 @@ val concat : 'a t t -> 'a t
|
||||||
val flatten : 'a t t -> 'a t
|
val flatten : 'a t t -> 'a t
|
||||||
(** Alias for {!concat} *)
|
(** 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
|
val flat_map : f:('a -> 'b t) -> 'a t -> 'b t
|
||||||
(** Alias to {!flatMap} with a more explicit name *)
|
(** Monadic bind. Intuitively, it applies the function to every
|
||||||
|
element of the initial sequence, and calls {!concat}. *)
|
||||||
val fmap : f:('a -> 'b option) -> 'a t -> 'b t
|
|
||||||
(** @deprecated use {!filter_map} *)
|
|
||||||
|
|
||||||
val filter_map : f:('a -> 'b option) -> 'a t -> 'b t
|
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
|
val intersperse : x:'a -> 'a t -> 'a t
|
||||||
(** Insert the single element between every element of the sequence *)
|
(** Insert the single element between every element of the sequence *)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue