quickcheck-monoid-subclasses-0.3.0.4: Testing monoid subclass instances with QuickCheck
Copyright© 2022–2024 Jonathan Knowles
LicenseApache-2.0
Safe HaskellNone
LanguageHaskell2010

Test.QuickCheck.Classes.Monoid.LCM

Description

This module provides Laws definitions for classes exported by Data.Monoid.LCM.

Synopsis

Documentation

lcmMonoidLaws :: (Arbitrary a, Show a, Eq a, LCMMonoid a) => Proxy a -> Laws Source #

Laws for instances of LCMMonoid.

Includes the following laws:

Reductivity

isJust (lcm a b </> a)
isJust (lcm a b </> b)

Uniqueness

all isJust
    [       c </> a
    ,       c </> b
    , lcm a b </> c
    ]
==>
    (lcm a b == c)

Idempotence

lcm a a == a

Identity

lcm mempty a == a
lcm a mempty == a

Commutativity

lcm a b == lcm b a

Associativity

lcm (lcm a b) c == lcm a (lcm b c)

Absorption

lcm a (gcd a b) == a
gcd a (lcm a b) == a

Note that the following superclass laws are not included:

distributiveLCMMonoidLaws :: (Arbitrary a, Show a, Eq a, DistributiveLCMMonoid a) => Proxy a -> Laws Source #

Laws for instances of DistributiveLCMMonoid.

Includes the following laws:

Left-distributivity

lcm (a <> b) (a <> c) == a <> lcm b c

Right-distributivity

lcm (a <> c) (b <> c) == lcm a b <> c

Lattice distributivity

lcm a (gcd b c) == gcd (lcm a b) (lcm a c)
gcd a (lcm b c) == lcm (gcd a b) (gcd a c)

Note that the following superclass laws are not included: