quickcheck-groups-0.0.1.0: Testing group class instances with QuickCheck
Copyright© 2022–2023 Jonathan Knowles
LicenseApache-2.0
Safe HaskellSafe-Inferred
LanguageHaskell2010

Test.QuickCheck.Classes.Group

Contents

Description

This module provides Laws definitions for classes exported by Data.Group.

Synopsis

Group

groupLaws :: forall a. (Arbitrary a, Show a, Eq a, Group a) => Proxy a -> Laws Source #

Laws for instances of Group.

Includes the following laws:

Inversion

invert mempty == mempty
invert (invert a) == a
       a <> invert a == mempty
invert a <>        a == mempty

Subtraction

a ~~ mempty == a
a ~~ a == mempty
a ~~ b == a <> invert b

Exponentiation

pow a 0 == mempty
n >= 0 ==> pow a n ==         mconcat (replicate      n  a)
n <= 0 ==> pow a n == invert (mconcat (replicate (abs n) a))

Superclass laws

Note that the following superclass laws are not included:

Abelian

abelianLaws :: forall a. (Arbitrary a, Show a, Eq a, Abelian a) => Proxy a -> Laws Source #

Laws for instances of Abelian.

Includes the following law:

Commutativity

a <> b == b <> a

Superclass laws

Note that the following superclass laws are not included: