Copyright | © 2022–2024 Jonathan Knowles |
---|---|
License | Apache-2.0 |
Safe Haskell | None |
Language | Haskell2010 |
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</>
gcd
a b)
isJust
(b</>
gcd
a b)
Uniqueness
all
isJust
[ a</>
c , b</>
c , c</>
gcd
a b ] ==> (c==
gcd
a b)
Idempotence
gcd
a a==
a
Identity
gcd
mempty
a==
mempty
gcd
amempty
==
mempty
Commutativity
gcd
a b==
gcd
b a
Associativity
gcd
(gcd
a b) c==
gcd
a (gcd
b c)
Equivalences
gcd
a b==
commonPrefix
a b
gcd
a b==
commonSuffix
a 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
(commonPrefix
a b) a)
isJust
(stripPrefix
(commonPrefix
a b) b)
Uniqueness
all
isJust
[stripPrefix
c a ,stripPrefix
c b ,stripPrefix
(commonPrefix
a b) c ] ==> (c==
commonPrefix
a b)
Idempotence
commonPrefix
a a==
a
Identity
commonPrefix
mempty
a==
mempty
commonPrefix
amempty
==
mempty
Commutativity
commonPrefix
a b==
commonPrefix
b a
Associativity
commonPrefix
(commonPrefix
a b) c==
commonPrefix
a (commonPrefix
b c)
Equivalences
stripCommonPrefix
a b&
\(p, _, _) -> p==
commonPrefix
a b
stripCommonPrefix
a b&
\(p, x, _) -> p<>
x==
a
stripCommonPrefix
a b&
\(p, _, x) -> p<>
x==
b
stripCommonPrefix
a b&
\(p, x, _) ->Just
x==
stripPrefix
p a
stripCommonPrefix
a b&
\(p, _, x) ->Just
x==
stripPrefix
p 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
(commonSuffix
a b) a)
isJust
(stripSuffix
(commonSuffix
a b) b)
Uniqueness
all
isJust
[stripSuffix
c a ,stripSuffix
c b ,stripSuffix
(commonSuffix
a b) c ] ==> (c==
commonSuffix
a b)
Idempotence
commonSuffix
a a==
a
Identity
commonSuffix
mempty
a==
mempty
commonSuffix
amempty
==
mempty
Commutativity
commonSuffix
a b==
commonSuffix
b a
Associativity
commonSuffix
(commonSuffix
a b) c==
commonSuffix
a (commonSuffix
b c)
Equivalences
stripCommonSuffix
a b&
\(_, _, s) -> s==
commonSuffix
a b
stripCommonSuffix
a b&
\(x, _, s) -> x<>
s==
a
stripCommonSuffix
a b&
\(_, x, s) -> x<>
s==
b
stripCommonSuffix
a b&
\(x, _, s) ->Just
x==
stripSuffix
s a
stripCommonSuffix
a b&
\(_, x, s) ->Just
x==
stripSuffix
s 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
(overlap
a b) a)
isJust
(stripPrefix
(overlap
a b) b)
Idempotence
overlap
a a==
a
Identity
overlap
mempty
a==
mempty
overlap
amempty
==
mempty
Equivalences
overlap
a b<>
stripPrefixOverlap
a b==
b
stripSuffixOverlap
b a<>
overlap
a b==
a
stripOverlap
a b&
\(_, x, _) -> x==
overlap
a b
stripOverlap
a b&
\(_, _, x) -> x==
stripPrefixOverlap
a b
stripOverlap
a b&
\(x, _, _) -> x==
stripSuffixOverlap
b 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<>
commonPrefix
b 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)==
commonSuffix
a b<>
c
Note that the following superclass laws are not included: