Module

Test.QuickCheck.Laws.Data.Semiring

Package
purescript-quickcheck-laws
Repository
garyb/purescript-quickcheck-laws

#checkSemiring Source

checkSemiring :: forall a eff. Semiring a => Arbitrary a => Eq a => Proxy a -> QC eff 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