Module Applicative.Law
Law
notes the laws that should be obeyed by any instantiation of Applicative in the form of predicates that should be true for any arguments of the appropriate type.
You can use Alg_qcheck
.Applicative to generate property based tests of these laws for new modules satisfying this interface.
- parameter A
An implementation of Applicative
Parameters
Signature
val identity : 'a A.t -> bool
identity x
:return Fun.id <*> x = x
val composition : ('b -> 'c) A.t -> ('a -> 'b) A.t -> 'a A.t -> bool
composition u v w
:(return (%) <*> u <*> v <*> w) = (u <*> (v <*> w))
val interchange : ('a -> 'b) A.t -> 'a -> bool
interchange u y
:(u <*> return y) = (return (fun f -> f y) <*> u)