| Copyright | © 2022–2025 Jonathan Knowles |
|---|---|
| License | Apache-2.0 |
| Safe Haskell | None |
| Language | Haskell2010 |
Test.QuickCheck.Classes.Monoid.GCD
Description
This module provides Laws definitions for classes exported by
Data.Monoid.GCD.
Synopsis
- gcdMonoidLaws :: (Arbitrary a, Show a, Eq a, GCDMonoid a) => Proxy a -> Laws
- leftGCDMonoidLaws :: (Arbitrary a, Show a, Eq a, LeftGCDMonoid a) => Proxy a -> Laws
- rightGCDMonoidLaws :: (Arbitrary a, Show a, Eq a, RightGCDMonoid a) => Proxy a -> Laws
- overlappingGCDMonoidLaws :: (Arbitrary a, Show a, Eq a, OverlappingGCDMonoid a) => Proxy a -> Laws
- distributiveGCDMonoidLaws :: (Arbitrary a, Show a, Eq a, DistributiveGCDMonoid a) => Proxy a -> Laws
- leftDistributiveGCDMonoidLaws :: (Arbitrary a, Show a, Eq a, LeftDistributiveGCDMonoid a) => Proxy a -> Laws
- rightDistributiveGCDMonoidLaws :: (Arbitrary a, Show a, Eq a, RightDistributiveGCDMonoid a) => Proxy a -> Laws
Documentation
gcdMonoidLaws :: (Arbitrary a, Show a, Eq a, GCDMonoid a) => Proxy a -> Laws Source #
Laws for instances of GCDMonoid.
Includes the following laws:
Reductivity
isJust(a</>gcda b)
isJust(b</>gcda b)
Uniqueness
allisJust[ a</>c , b</>c , c</>gcda b ] ==> (c==gcda b)
Idempotence
gcda a==a
Identity
gcdmemptya==mempty
gcdamempty==mempty
Commutativity
gcda b==gcdb a
Associativity
gcd(gcda b) c==gcda (gcdb c)
Equivalences
gcda b==commonPrefixa b
gcda b==commonSuffixa b
Note that the following superclass laws are not included:
leftGCDMonoidLaws :: (Arbitrary a, Show a, Eq a, LeftGCDMonoid a) => Proxy a -> Laws Source #
Laws for instances of LeftGCDMonoid.
Includes the following laws:
Reductivity
isJust(stripPrefix(commonPrefixa b) a)
isJust(stripPrefix(commonPrefixa b) b)
Uniqueness
allisJust[stripPrefixc a ,stripPrefixc b ,stripPrefix(commonPrefixa b) c ] ==> (c==commonPrefixa b)
Idempotence
commonPrefixa a==a
Identity
commonPrefixmemptya==mempty
commonPrefixamempty==mempty
Commutativity
commonPrefixa b==commonPrefixb a
Associativity
commonPrefix(commonPrefixa b) c==commonPrefixa (commonPrefixb c)
Equivalences
stripCommonPrefixa b&\(p, _, _) -> p==commonPrefixa b
stripCommonPrefixa b&\(p, x, _) -> p<>x==a
stripCommonPrefixa b&\(p, _, x) -> p<>x==b
stripCommonPrefixa b&\(p, x, _) ->Justx==stripPrefixp a
stripCommonPrefixa b&\(p, _, x) ->Justx==stripPrefixp b
Note that the following superclass laws are not included:
rightGCDMonoidLaws :: (Arbitrary a, Show a, Eq a, RightGCDMonoid a) => Proxy a -> Laws Source #
Laws for instances of RightGCDMonoid.
Includes the following laws:
Reductivity
isJust(stripSuffix(commonSuffixa b) a)
isJust(stripSuffix(commonSuffixa b) b)
Uniqueness
allisJust[stripSuffixc a ,stripSuffixc b ,stripSuffix(commonSuffixa b) c ] ==> (c==commonSuffixa b)
Idempotence
commonSuffixa a==a
Identity
commonSuffixmemptya==mempty
commonSuffixamempty==mempty
Commutativity
commonSuffixa b==commonSuffixb a
Associativity
commonSuffix(commonSuffixa b) c==commonSuffixa (commonSuffixb c)
Equivalences
stripCommonSuffixa b&\(_, _, s) -> s==commonSuffixa b
stripCommonSuffixa b&\(x, _, s) -> x<>s==a
stripCommonSuffixa b&\(_, x, s) -> x<>s==b
stripCommonSuffixa b&\(x, _, s) ->Justx==stripSuffixs a
stripCommonSuffixa b&\(_, x, s) ->Justx==stripSuffixs b
Note that the following superclass laws are not included:
overlappingGCDMonoidLaws :: (Arbitrary a, Show a, Eq a, OverlappingGCDMonoid a) => Proxy a -> Laws Source #
Laws for instances of OverlappingGCDMonoid.
Includes the following laws:
Reductivity
isJust(stripSuffix(overlapa b) a)
isJust(stripPrefix(overlapa b) b)
Idempotence
overlapa a==a
Identity
overlapmemptya==mempty
overlapamempty==mempty
Equivalences
overlapa b<>stripPrefixOverlapa b==b
stripSuffixOverlapb a<>overlapa b==a
stripOverlapa b&\(_, x, _) -> x==overlapa b
stripOverlapa b&\(_, _, x) -> x==stripPrefixOverlapa b
stripOverlapa b&\(x, _, _) -> x==stripSuffixOverlapb a
Note that the following superclass laws are not included:
distributiveGCDMonoidLaws :: (Arbitrary a, Show a, Eq a, DistributiveGCDMonoid a) => Proxy a -> Laws Source #
leftDistributiveGCDMonoidLaws :: (Arbitrary a, Show a, Eq a, LeftDistributiveGCDMonoid a) => Proxy a -> Laws Source #
Laws for instances of LeftDistributiveGCDMonoid.
Includes the following law:
Left-distributivity
commonPrefix(a<>b) (a<>c)==a<>commonPrefixb c
Note that the following superclass laws are not included:
rightDistributiveGCDMonoidLaws :: (Arbitrary a, Show a, Eq a, RightDistributiveGCDMonoid a) => Proxy a -> Laws Source #
Laws for instances of RightDistributiveGCDMonoid.
Includes the following law:
Right-distributivity
commonSuffix(a<>c) (b<>c)==commonSuffixa b<>c
Note that the following superclass laws are not included: