diff --git a/qCheck.ml b/qCheck.ml index c30bb671..e4493dee 100644 --- a/qCheck.ml +++ b/qCheck.ml @@ -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 diff --git a/qCheck.mli b/qCheck.mli index 68ba6f49..bfa12eaa 100644 --- a/qCheck.mli +++ b/qCheck.mli @@ -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