Qcheck_extra.ApplicativeApplicative extends Functor with an map2 and return method, allowing us to lift functions of arbitrary arity.
We can define and+ in terms of map2 and vice versa:
let (and+) = map2 (fun x y -> (x,y))
let map2 f x y =
let+ a = x
and+ b = y in
f x yassuming
(and+) = product
and
(let+) x f = map f x .
An Applicative should satisfy:
product (product x y) z = product x (product y z) product (return ()) x = x = product x (return ()) module type S = sig ... end