Copyright | © 2022–2023 Jonathan Knowles |
---|---|
License | Apache-2.0 |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Test.QuickCheck.Classes.Monoid.GCD
Description
This module provides Laws
definitions for classes exported by
Data.Monoid.GCD.
Synopsis
- gcdMonoidLaws :: forall a. (Arbitrary a, Show a, Eq a, GCDMonoid a) => Proxy a -> Laws
- cancellativeGCDMonoidLaws :: forall a. (Arbitrary a, Show a, Eq a, Cancellative a, GCDMonoid a) => Proxy a -> Laws
- leftGCDMonoidLaws :: forall a. (Arbitrary a, Show a, Eq a, LeftGCDMonoid a) => Proxy a -> Laws
- rightGCDMonoidLaws :: forall a. (Arbitrary a, Show a, Eq a, RightGCDMonoid a) => Proxy a -> Laws
- overlappingGCDMonoidLaws :: forall a. (Arbitrary a, Show a, Eq a, OverlappingGCDMonoid a) => Proxy a -> Laws
Documentation
gcdMonoidLaws :: forall a. (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)
Distributivity
gcd
(a<>
b) (a<>
c)==
a<>
gcd
b c
gcd
(a<>
c) (b<>
c)==
gcd
a b<>
c
Equivalence
gcd
a b==
commonPrefix
a b
gcd
a b==
commonSuffix
a b
Note that the following superclass laws are not included:
cancellativeGCDMonoidLaws :: forall a. (Arbitrary a, Show a, Eq a, Cancellative a, GCDMonoid a) => Proxy a -> Laws Source #
leftGCDMonoidLaws :: forall a. (Arbitrary a, Show a, Eq a, LeftGCDMonoid a) => Proxy a -> Laws Source #
Laws
for instances of LeftGCDMonoid
.
Includes the following laws:
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 :: forall a. (Arbitrary a, Show a, Eq a, RightGCDMonoid a) => Proxy a -> Laws Source #
Laws
for instances of RightGCDMonoid
.
Includes the following laws:
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 :: forall a. (Arbitrary a, Show a, Eq a, OverlappingGCDMonoid a) => Proxy a -> Laws Source #
Laws
for instances of OverlappingGCDMonoid
.
Includes the following laws:
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: