Module

Test.StrongCheck.Laws.Data.Semiring

Package
purescript-strongcheck-laws
Repository
garyb/purescript-strongcheck-laws

#checkSemiring Source

checkSemiring :: forall a. Semiring a => Arbitrary a => Eq a => Proxy a -> Effect Unit
  • Commutative monoid under addition:
    • Associativity: (a + b) + c = a + (b + c)
    • Identity: zero + a = a + zero = a
    • Commutative: a + b = b + a
  • Monoid under multiplication:
    • Associativity: (a * b) * c = a * (b * c)
    • Identity: one * a = a * one = a
  • Multiplication distributes over addition:
    • Left distributivity: a * (b + c) = (a * b) + (a * c)
    • Right distributivity: (a + b) * c = (a * c) + (b * c)
  • Annihiliation: zero * a = a * zero = zero