mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2025-12-06 03:05:28 -05:00
improvements in QCheck (monadic bind)
This commit is contained in:
parent
3f9a33e1d0
commit
3e46b3193d
2 changed files with 7 additions and 0 deletions
|
|
@ -134,6 +134,10 @@ module Arbitrary = struct
|
|||
|
||||
let quad a b c d = lift4 (fun x y z w -> x,y,z,w) a b c d
|
||||
|
||||
let (>>=) a f st =
|
||||
let x = a st in
|
||||
f x st
|
||||
|
||||
let generate ?(n=100) ?(rand=Random.State.make_self_init()) gen =
|
||||
let l = ref [] in
|
||||
for i = 0 to n-1 do
|
||||
|
|
|
|||
|
|
@ -158,6 +158,9 @@ module Arbitrary : sig
|
|||
val lift3 : ('a -> 'b -> 'c -> 'd) -> 'a t -> 'b t -> 'c t -> 'd t
|
||||
val lift4 : ('a -> 'b -> 'c -> 'd -> 'e) -> 'a t -> 'b t -> 'c t -> 'd t -> 'e t
|
||||
|
||||
val (>>=) : 'a t -> ('a -> 'b t) -> 'b t
|
||||
(** Monadic bind *)
|
||||
|
||||
val generate : ?n:int -> ?rand:Random.State.t -> 'a t -> 'a list
|
||||
(** Generate [n] random values of the given type *)
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue