package alg_structs

  1. Overview
  2. Docs

Law notes the laws that should be obeyed by any instantiation of Monoid in the form of predicates that should hold true for any arguments of the appropriate type.

You can use the alg_structs_qcheck package to generate property based tests of these laws for new modules satisfying this interface.

  • parameter M

    An implementation of Monoid

Parameters

module M : S

Signature

val associativity : M.t -> M.t -> M.t -> bool

From Semigroup.Law

associativity x y z is true when

S.(x * (y * z)) = S.((x * y) * z)
val unit_right_cancelation : M.t -> bool

unit_right_cancelation x is true when

S.(x * unit) = unit
val unit_left_cancelation : M.t -> bool

unit_left_cancelation x is true when

S.(unit * x) = unit
val mconcat_is_a_fold_right : M.t list -> bool

mconcat_is_a_fold_right xs is true when

(M.mconcat xs) = List.fold_right M.op xs M.unit
OCaml

Innovation. Community. Security.