genvalidity-property-1.0.0.0: Standard properties for functions on `Validity` types
Safe HaskellNone
LanguageHaskell2010

Test.Validity.Operations.Identity

Synopsis

Documentation

leftIdentityOnElemWithEquality Source #

Arguments

:: (b -> a -> a)

A binary operation

-> (a -> a -> Bool)

An equality

-> b

A candidate left-identity

-> a

An element

-> Bool 

\[ LeftIdentity(\star, \doteq, b) \quad\equiv\quad \forall a: (b \star a) \doteq a \]

leftIdentityOnGenWithEquality Source #

Arguments

:: Show a 
=> (b -> a -> a)

A binary operation

-> (a -> a -> Bool)

An equality

-> b

A candidate left-identity

-> Gen a 
-> (a -> [a]) 
-> Property 

leftIdentityOnGen Source #

Arguments

:: (Show a, Eq a) 
=> (b -> a -> a)

A binary operation

-> b

A candidate left-identity

-> Gen a 
-> (a -> [a]) 
-> Property 

leftIdentity :: (Show a, Eq a, GenValid a) => (b -> a -> a) -> b -> Property Source #

leftIdentity (flip ((^) :: Int -> Int -> Int)) 1

leftIdentityOnArbitrary :: (Show a, Eq a, Arbitrary a) => (b -> a -> a) -> b -> Property Source #

leftIdentityOnArbitrary (flip ((^) :: Int -> Int -> Int)) 1

rightIdentityOnElemWithEquality Source #

Arguments

:: (a -> b -> a)

A binary operation

-> (a -> a -> Bool)

An equality

-> b

A candidate right-identity

-> a

An element

-> Bool 

\[ RightIdentity(\star, \doteq, b) \quad\equiv\quad \forall a: (a \star b) \doteq a \]

rightIdentityOnGenWithEquality Source #

Arguments

:: Show a 
=> (a -> b -> a)

A binary operation

-> (a -> a -> Bool)

An equality

-> b

A candidate right-identity

-> Gen a 
-> (a -> [a]) 
-> Property 

rightIdentityOnGen Source #

Arguments

:: (Show a, Eq a) 
=> (a -> b -> a)

A binary operation

-> b

A candidate right-identity

-> Gen a 
-> (a -> [a]) 
-> Property 

rightIdentity :: (Show a, Eq a, GenValid a) => (a -> b -> a) -> b -> Property Source #

rightIdentity ((^) :: Int -> Int -> Int) 1

rightIdentityOnArbitrary :: (Show a, Eq a, Arbitrary a) => (a -> b -> a) -> b -> Property Source #

rightIdentityOnArbitrary ((^) :: Int -> Int -> Int) 1

identityOnGen :: (Show a, Eq a) => (a -> a -> a) -> a -> Gen a -> (a -> [a]) -> Property Source #

\[ Identity(\star, \doteq, b) \quad\equiv\quad LeftIdentity(\star, \doteq, b) \wedge RightIdentity(\star, \doteq, b) \]

identity :: (Show a, Eq a, GenValid a) => (a -> a -> a) -> a -> Property Source #

identity ((*) :: Int -> Int -> Int) 1
identity ((+) :: Int -> Int -> Int) 0

identityOnArbitrary :: (Show a, Eq a, Arbitrary a) => (a -> a -> a) -> a -> Property Source #

identityOnArbitrary ((*) :: Int -> Int -> Int) 1
identityOnArbitrary ((+) :: Int -> Int -> Int) 0