Module
Test.QuickCheck.Laws.Data
- Package
- purescript-quickcheck-laws
- Repository
- purescript-contrib/purescript-quickcheck-laws
Re-exports from Test.QuickCheck.Laws.Data.BooleanAlgebra
#checkBooleanAlgebra Source
checkBooleanAlgebra :: forall a. Arbitrary a => BooleanAlgebra a => Eq a => Proxy a -> Effect Unit
- Excluded middle:
a || not a = tt
Re-exports from Test.QuickCheck.Laws.Data.Bounded
Re-exports from Test.QuickCheck.Laws.Data.BoundedEnum
#checkBoundedEnum Source
checkBoundedEnum :: forall a. Arbitrary a => BoundedEnum a => Ord a => Proxy a -> Effect Unit
- succ:
succ bottom >>= succ >>= succ ... succ [cardinality - 1 times] = top
- pred:
pred top >>= pred >>= pred ... pred [cardinality - 1 times] = bottom
- predsucc:
forall a > bottom: pred a >>= succ = Just a
- succpred:
forall a < top: succ a >>= pred = Just a
- enumpred:
forall a > bottom: fromEnum <$> pred a = Just (fromEnum a - 1)
- enumsucc:
forall a < top: fromEnum <$> succ a = Just (fromEnum a + 1)
- compare:
compare e1 e2 = compare (fromEnum e1) (fromEnum e2)
- tofromenum:
toEnum (fromEnum a) = Just a
Re-exports from Test.QuickCheck.Laws.Data.CommutativeRing
#checkCommutativeRing Source
checkCommutativeRing :: forall a. CommutativeRing a => Arbitrary a => Eq a => Proxy a -> Effect Unit
- Commutative multiplication:
a * b = b * a
Re-exports from Test.QuickCheck.Laws.Data.DivisionRing
#checkDivisionRing Source
checkDivisionRing :: forall a. DivisionRing a => Arbitrary a => Eq a => Proxy a -> Effect Unit
Non-zero ring: one /= zero Non-zero multiplicative inverse: recip a * a = a * recip a = one for all non-zero a
Re-exports from Test.QuickCheck.Laws.Data.Eq
Re-exports from Test.QuickCheck.Laws.Data.EuclideanRing
#checkEuclideanRing Source
checkEuclideanRing :: forall a. EuclideanRing a => Arbitrary a => Eq a => Proxy a -> Effect Unit
- Integral domain:
one /= zero
, and ifa
andb
are both nonzero then so is their producta * b
- Euclidean function
degree
:- Nonnegativity: For all nonzero
a
,degree a >= 0
- Quotient/remainder: For all
a
andb
, whereb
is nonzero, letq = a / b
andr = a `mod` b
; thena = q*b + r
, and also eitherr = zero
ordegree r < degree b
- Nonnegativity: For all nonzero
- Submultiplicative euclidean function:
- For all nonzero
a
andb
,degree a <= degree (a * b)
- For all nonzero
Re-exports from Test.QuickCheck.Laws.Data.Foldable
Re-exports from Test.QuickCheck.Laws.Data.Functor
Re-exports from Test.QuickCheck.Laws.Data.FunctorWithIndex
#checkFunctorWithIndex Source
checkFunctorWithIndex :: forall f i. FunctorWithIndex i f => Arbitrary (f A) => Coarbitrary i => Eq (f A) => Proxy2 f -> Effect Unit
- Identity:
mapWithIndex (\_ a → a) = identity
- Composition:
mapWithIndex f . mapWithIndex g = mapWithIndex (\i → f i <<< g i)
Re-exports from Test.QuickCheck.Laws.Data.HeytingAlgebra
#checkHeytingAlgebra Source
checkHeytingAlgebra :: forall a. Arbitrary a => HeytingAlgebra a => Eq a => Proxy a -> Effect Unit
- Associativity:
a || (b || c) = (a || b) || c
a && (b && c) = (a && b) && c
- Commutativity:
a || b = b || a
a && b = b && a
- Absorption:
a || (a && b) = a
a && (a || b) = a
- Idempotent:
a || a = a
a && a = a
- Identity:
a || ff = a
a && tt = a
- Implication:
a `implies` a = tt
a && (a `implies` b) = a && b
b && (a `implies` b) = b
a `implies` (b && c) = (a `implies` b) && (a `implies` c)
- Complemented:
not a = a `implies` ff
Re-exports from Test.QuickCheck.Laws.Data.Monoid
Re-exports from Test.QuickCheck.Laws.Data.Ord
Re-exports from Test.QuickCheck.Laws.Data.Ring
Re-exports from Test.QuickCheck.Laws.Data.Semigroup
Re-exports from Test.QuickCheck.Laws.Data.Semiring
#checkSemiring Source
checkSemiring :: forall a. Semiring a => Arbitrary a => Eq a => Proxy a -> Effect Unit
- Commutative monoid under addition:
- Associativity:
(a + b) + c = a + (b + c)
- Identity:
zero + a = a + zero = a
- Commutative:
a + b = b + a
- Associativity:
- Monoid under multiplication:
- Associativity:
(a * b) * c = a * (b * c)
- Identity:
one * a = a * one = a
- Associativity:
- Multiplication distributes over addition:
- Left distributivity:
a * (b + c) = (a * b) + (a * c)
- Right distributivity:
(a + b) * c = (a * c) + (b * c)
- Left distributivity:
- Annihiliation:
zero * a = a * zero = zero
- Modules
- Test.
QuickCheck. Laws - Test.
QuickCheck. Laws. Control - Test.
QuickCheck. Laws. Control. Alt - Test.
QuickCheck. Laws. Control. Alternative - Test.
QuickCheck. Laws. Control. Applicative - Test.
QuickCheck. Laws. Control. Apply - Test.
QuickCheck. Laws. Control. Bind - Test.
QuickCheck. Laws. Control. Category - Test.
QuickCheck. Laws. Control. Comonad - Test.
QuickCheck. Laws. Control. Extend - Test.
QuickCheck. Laws. Control. Monad - Test.
QuickCheck. Laws. Control. MonadPlus - Test.
QuickCheck. Laws. Control. MonadZero - Test.
QuickCheck. Laws. Control. Plus - Test.
QuickCheck. Laws. Control. Semigroupoid - Test.
QuickCheck. Laws. Data - Test.
QuickCheck. Laws. Data. BooleanAlgebra - Test.
QuickCheck. Laws. Data. Bounded - Test.
QuickCheck. Laws. Data. BoundedEnum - Test.
QuickCheck. Laws. Data. CommutativeRing - Test.
QuickCheck. Laws. Data. DivisionRing - Test.
QuickCheck. Laws. Data. Eq - Test.
QuickCheck. Laws. Data. EuclideanRing - Test.
QuickCheck. Laws. Data. Field - Test.
QuickCheck. Laws. Data. Foldable - Test.
QuickCheck. Laws. Data. Functor - Test.
QuickCheck. Laws. Data. FunctorWithIndex - Test.
QuickCheck. Laws. Data. HeytingAlgebra - Test.
QuickCheck. Laws. Data. Monoid - Test.
QuickCheck. Laws. Data. Ord - Test.
QuickCheck. Laws. Data. Ring - Test.
QuickCheck. Laws. Data. Semigroup - Test.
QuickCheck. Laws. Data. Semiring