mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2025-12-06 11:15:31 -05:00
CCList.(>|=) infix map
This commit is contained in:
parent
73201a4e67
commit
ed3bf4ba26
2 changed files with 7 additions and 1 deletions
|
|
@ -51,6 +51,8 @@ let map f l =
|
||||||
List.rev (List.rev_map f l) = map f l)
|
List.rev (List.rev_map f l) = map f l)
|
||||||
*)
|
*)
|
||||||
|
|
||||||
|
let (>|=) l f = map f l
|
||||||
|
|
||||||
let append l1 l2 =
|
let append l1 l2 =
|
||||||
let rec direct i l1 l2 = match l1 with
|
let rec direct i l1 l2 = match l1 with
|
||||||
| [] -> l2
|
| [] -> l2
|
||||||
|
|
@ -550,7 +552,7 @@ module type MONAD = sig
|
||||||
end
|
end
|
||||||
|
|
||||||
module Traverse(M : MONAD) = struct
|
module Traverse(M : MONAD) = struct
|
||||||
open M
|
open! M
|
||||||
|
|
||||||
let map_m f l =
|
let map_m f l =
|
||||||
let rec aux f acc l = match l with
|
let rec aux f acc l = match l with
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,10 @@ val empty : 'a t
|
||||||
val map : ('a -> 'b) -> 'a t -> 'b t
|
val map : ('a -> 'b) -> 'a t -> 'b t
|
||||||
(** Safe version of map *)
|
(** Safe version of map *)
|
||||||
|
|
||||||
|
val (>|=) : 'a t -> ('a -> 'b) -> 'b t
|
||||||
|
(** Infix version of [map] with reversed arguments
|
||||||
|
@since NEXT_RELEASE *)
|
||||||
|
|
||||||
val append : 'a t -> 'a t -> 'a t
|
val append : 'a t -> 'a t -> 'a t
|
||||||
(** Safe version of append *)
|
(** Safe version of append *)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue