Copyright | © 2022–2024 Jonathan Knowles |
---|---|
License | Apache-2.0 |
Safe Haskell | None |
Language | Haskell2010 |
This module provides Laws
definitions for classes exported by
Data.Semigroup.Factorial.
Synopsis
- factorialLaws :: (Arbitrary a, Show a, Eq a, Factorial a) => Proxy a -> Laws
- stableFactorialLaws :: (Arbitrary a, Show a, Eq a, StableFactorial a) => Proxy a -> Laws
Documentation
factorialLaws :: (Arbitrary a, Show a, Eq a, Factorial a) => Proxy a -> Laws Source #
Laws
for instances of Factorial
.
Includes the following laws:
length
a==
Data.List.length
(factors
a)
maybe
asconcat
(nonEmpty
$factors
a)==
amaybe
asconcat
(nonEmpty
$reverse
$factors
a)==
reverse
a
all
(\f ->factors
f==
[f]) (factors
a)
primePrefix
a==
foldr
(\x _ -> x) a aprimeSuffix
a==
foldl
(\_ x -> x) a a
foldl
f x a==
Data.List.foldl
f x (factors
a)foldl'
f x a==
Data.List.foldl'
f x (factors
a)foldr
f x a==
Data.List.foldr
f x (factors
a)
Note that the following superclass laws are not included:
stableFactorialLaws :: (Arbitrary a, Show a, Eq a, StableFactorial a) => Proxy a -> Laws Source #
Laws
for instances of StableFactorial
.
Includes the following laws:
factors
(a<>
b)==
factors
a<>
factors
b
factors
(reverse
a)==
Data.List.reverse
(factors
a)
primePrefix
a==
primeSuffix
(reverse
a)primeSuffix
a==
primePrefix
(reverse
a)
Note that the following superclass laws are not included: