Copyright | © 2022–2024 Jonathan Knowles |
---|---|
License | Apache-2.0 |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
This module provides Laws
definitions for classes exported by
Data.Monoid.Factorial.
Synopsis
- factorialMonoidLaws :: forall a. (Arbitrary a, Show a, Eq a, FactorialMonoid a) => Proxy a -> Laws
Documentation
factorialMonoidLaws :: forall a. (Arbitrary a, Show a, Eq a, FactorialMonoid a) => Proxy a -> Laws Source #
Laws
for instances of FactorialMonoid
.
Includes the following laws:
null
a==
null
(factors
a)
factors
a==
(unfoldr
splitPrimePrefix
a)factors
a==
reverse
(unfoldr
(fmap
swap
.splitPrimeSuffix
) a)
reverse
a==
mconcat
(reverse
(factors
a))
primePrefix
a==
maybe
mempty
fst
(splitPrimePrefix
a)primeSuffix
a==
maybe
mempty
snd
(splitPrimeSuffix
a)
inits
a==
fmap
mconcat
(inits
(factors
a))tails
a==
fmap
mconcat
(tails
(factors
a))
span
p a==
bimap
mconcat
mconcat
(span
p (factors
a))
all
(all
(not
. p) .factors
) (split
p a)
mconcat
(intersperse
p (split
(==
p) a))==
a
splitAt
i a==
bimap
mconcat
mconcat
(splitAt
i (factors
a))
Note that the following superclass laws are not included: