mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2025-12-16 07:46:04 -05:00
Merge 912c6859cd into 2cdba5957c
This commit is contained in:
commit
0d5424a877
3 changed files with 9 additions and 1 deletions
|
|
@ -1362,6 +1362,7 @@ module Infix = struct
|
||||||
let (--) = int_range
|
let (--) = int_range
|
||||||
|
|
||||||
let (>>=) x f = flat_map f x
|
let (>>=) x f = flat_map f x
|
||||||
|
let (>>|) x f = map f x
|
||||||
end
|
end
|
||||||
|
|
||||||
include Infix
|
include Infix
|
||||||
|
|
@ -1543,6 +1544,7 @@ module Restart = struct
|
||||||
let (--) = int_range
|
let (--) = int_range
|
||||||
|
|
||||||
let (>>=) x f = flat_map f x
|
let (>>=) x f = flat_map f x
|
||||||
|
let (>>|) x f = map f x
|
||||||
end
|
end
|
||||||
|
|
||||||
include Infix
|
include Infix
|
||||||
|
|
|
||||||
|
|
@ -306,6 +306,9 @@ module type S = sig
|
||||||
|
|
||||||
val (>>=) : 'a t -> ('a -> 'b gen) -> 'b t
|
val (>>=) : 'a t -> ('a -> 'b gen) -> 'b t
|
||||||
(** Monadic bind operator *)
|
(** Monadic bind operator *)
|
||||||
|
|
||||||
|
val (>>|) : 'a t -> ('a -> 'b) -> 'b t
|
||||||
|
(** Monadic map operator *)
|
||||||
end
|
end
|
||||||
|
|
||||||
val (--) : int -> int -> int t
|
val (--) : int -> int -> int t
|
||||||
|
|
@ -314,6 +317,9 @@ module type S = sig
|
||||||
val (>>=) : 'a t -> ('a -> 'b gen) -> 'b t
|
val (>>=) : 'a t -> ('a -> 'b gen) -> 'b t
|
||||||
(** Monadic bind operator *)
|
(** Monadic bind operator *)
|
||||||
|
|
||||||
|
val (>>|) : 'a t -> ('a -> 'b) -> 'b t
|
||||||
|
(** Monadic map operator *)
|
||||||
|
|
||||||
val pp : ?start:string -> ?stop:string -> ?sep:string -> ?horizontal:bool ->
|
val pp : ?start:string -> ?stop:string -> ?sep:string -> ?horizontal:bool ->
|
||||||
(Format.formatter -> 'a -> unit) -> Format.formatter -> 'a t -> unit
|
(Format.formatter -> 'a -> unit) -> Format.formatter -> 'a t -> unit
|
||||||
(** Pretty print the content of the generator on a formatter. *)
|
(** Pretty print the content of the generator on a formatter. *)
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@ let test_iter () =
|
||||||
|
|
||||||
let test_map () =
|
let test_map () =
|
||||||
let e = 1 -- 10 in
|
let e = 1 -- 10 in
|
||||||
let e' = Gen.map string_of_int e in
|
let e' = e >>| string_of_int in
|
||||||
OUnit.assert_equal ~printer:pstrlist ["9"; "10"] (Gen.to_list (Gen.drop 8 e'));
|
OUnit.assert_equal ~printer:pstrlist ["9"; "10"] (Gen.to_list (Gen.drop 8 e'));
|
||||||
()
|
()
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue