improvements in QCheck (monadic bind)

This commit is contained in:
Simon Cruanes 2013-10-04 15:19:47 +02:00
parent 3f9a33e1d0
commit 3e46b3193d
2 changed files with 7 additions and 0 deletions

View file

@ -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

View file

@ -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