Preface_specs.DivisibleDivisible is a "Contravariant Applicative Functor", in other word, Divisible is the dual of an Applicative
To have a predictable behaviour, the instance of Divisible must obey some laws.
Contravariant lawsdivide f x conquer = contramap (Stdlib.fst % f) xdivide f conquer x = contramap (Stdlib.snd % f) xdivide f (divide g m n) o
= divide
(fun x ->
let bc, _ = f x in
let b, c = g bc in
(a, (b, c)) )
m (divide id n o)module type WITH_DIVIDE_AND_CONQUER = sig ... endExposes the divide and conquer functions, mandatory for each requirement.
module type WITH_CONTRAMAP_AND_DIVIDE_AND_CONQUER = sig ... endmodule type CORE = WITH_CONTRAMAP_AND_DIVIDE_AND_CONQUERBasis operations.
module type OPERATION = sig ... endAdditional operations.
module type INFIX = sig ... endInfix operators.
module type API = sig ... endThe complete interface of a Divisible.