packages feed

test-invariant 0.4.4.0 → 0.4.5.0

raw patch · 2 files changed

+28/−3 lines, 2 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ Test.Invariant: (<??>) :: Eq a => (a -> a) -> (a -> a -> a) -> a -> a -> Bool
+ Test.Invariant: (<???>) :: Eq a => (a -> a) -> (a -> a -> a -> a) -> a -> a -> a -> Bool
+ Test.Invariant: fixedBy :: Eq c => (a -> b -> c) -> a -> b -> b -> Bool

Files

src/Test/Invariant.hs view
@@ -9,7 +9,7 @@ -- definitions of laws. -- -- > f(x) == g(x)--- > f <=> f . f+-- > f <=> g (<=>) :: Eq b => (a -> b) -> (a -> b) -> a -> Bool (f <=> g) x = f x == g x @@ -206,6 +206,15 @@ invariatesOver :: Eq b => (a -> b) -> (a -> a) -> a -> Bool f `invariatesOver` g = f . g <=> f +-- | Checks whether a binary function is fixed by an argument.+--+-- f x y == const a y+--+-- >>> quickCheck $ (*) `fixedBy` 0+-- +++ OK, passed 100 tests.+fixedBy :: Eq c => (a -> b -> c) -> a -> b -> b -> Bool+(f `fixedBy` x) y z = f x y == f x z+ -- | Checks whether a function is invariant over an other function. -- -- >>> quickCheck $ length <~~ reverse@@ -222,7 +231,7 @@ (@~>) :: Eq a => (b -> a) -> (a -> b) -> a -> Bool f @~> g = f . g <=> id --- | Checks whether two functions commutate.+-- | Checks whether a function is an endomorphism in relation to a unary operator. -- -- > f(g(x)) = g(f(x)) --@@ -230,3 +239,19 @@ -- +++ OK, passed 100 tests. (<?>) :: Eq a => (a -> a) -> (a -> a) -> a -> Bool f <?> g = f . g <=> g . f++-- | Checks whether a function is an endomorphism in relation to a binary operator.+--+-- > f(g(x,y)) = g(f(x),f(y))+--+-- >>> quickCheck $ (^2) <??> (*)+-- +++ OK, passed 100 tests.+(<??>) :: Eq a => (a -> a) -> (a -> a -> a) -> a -> a -> Bool+(f <??> g) x y = f (x `g` y) == f x `g` f y++-- | Checks whether a function is an endomorphism in relation to a ternary operator.+--+-- > f(g(x,y,z)) = g(f(x),f(y),f(z))+--+(<???>) :: Eq a => (a -> a) -> (a -> a -> a -> a) -> a -> a -> a -> Bool+(f <???> g) x y z = f (g x y z) == g (f x) (f y) (f z)
test-invariant.cabal view
@@ -1,5 +1,5 @@ name:                test-invariant-version:             0.4.4.0+version:             0.4.5.0 synopsis:            Provide common invariants to be checked with QuickCheck  description: test-invariant is a library for providing common invariants of