quickcheck-monoid-subclasses-0.3.0.4: Testing monoid subclass instances with QuickCheck
Copyright© 2022–2024 Jonathan Knowles
LicenseApache-2.0
Safe HaskellNone
LanguageHaskell2010

Test.QuickCheck.Classes.Monoid.Monus

Description

This module provides Laws definitions for classes exported by Data.Monoid.Monus.

Synopsis

Documentation

monusLaws :: (Arbitrary a, Show a, Eq a, Monus a) => Proxy a -> Laws Source #

Laws for instances of Monus.

Includes the following laws:

a <\> a == mempty
mempty <\> a == mempty
a <> (b <\> a) == b <> (a <\> b)
(a <\> b) <\> c == a <\> (b <> c)
a <\> b == stripPrefixOverlap b a
a <\> b == stripSuffixOverlap b a

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 a mempty == 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: