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.Semigroup.Cancellative

Description

This module provides Laws definitions for classes exported by Data.Semigroup.Cancellative.

Synopsis

Commutative

commutativeLaws :: (Arbitrary a, Show a, Eq a, Commutative a) => Proxy a -> Laws Source #

Laws for instances of Commutative.

Includes the following law:

a <> b == b <> a

Note that the following superclass laws are not included:

Reductive

reductiveLaws :: (Arbitrary a, Show a, Eq a, Reductive a) => Proxy a -> Laws Source #

Laws for instances of Reductive.

Includes the following laws:

a </> b == stripPrefix b a
a </> b == stripSuffix b a
maybe a (b <>) (a </> b) == a
maybe a (<> b) (a </> b) == a

Note that the following superclass laws are not included:

leftReductiveLaws :: (Arbitrary a, Show a, Eq a, LeftReductive a) => Proxy a -> Laws Source #

Laws for instances of LeftReductive.

Includes the following laws:

a `isPrefixOf` (a <> b)
isPrefixOf a b == isJust (stripPrefix a b)
maybe b (a <>) (stripPrefix a b) == b

Note that the following superclass laws are not included:

rightReductiveLaws :: (Arbitrary a, Show a, Eq a, RightReductive a) => Proxy a -> Laws Source #

Laws for instances of RightReductive.

Includes the following laws:

b `isSuffixOf` (a <> b)
isSuffixOf a b == isJust (stripSuffix a b)
maybe b (<> a) (stripSuffix a b) == b

Note that the following superclass laws are not included:

Cancellative

cancellativeLaws :: (Arbitrary a, Show a, Eq a, Cancellative a) => Proxy a -> Laws Source #

Laws for instances of Cancellative.

Includes the following laws:

(a <> b) </> a == Just b
(a <> b) </> b == Just a

Note that the following superclass laws are not included:

leftCancellativeLaws :: (Arbitrary a, Show a, Eq a, LeftCancellative a) => Proxy a -> Laws Source #

Laws for instances of LeftCancellative.

Includes the following law:

stripPrefix a (a <> b) == Just b

Note that the following superclass laws are not included:

rightCancellativeLaws :: (Arbitrary a, Show a, Eq a, RightCancellative a) => Proxy a -> Laws Source #

Laws for instances of RightCancellative.

Includes the following law:

stripSuffix b (a <> b) == Just a

Note that the following superclass laws are not included: