Copyright | (c) Michal Konecny |
---|---|
License | BSD3 |
Maintainer | mikkonecny@gmail.com |
Stability | experimental |
Portability | portable |
Safe Haskell | None |
Language | Haskell98 |
Synopsis
- type HasEq t1 t2 = (HasEqAsymmetric t1 t2, HasEqAsymmetric t2 t1, EqCompareType t1 t2 ~ EqCompareType t2 t1)
- class IsBool (EqCompareType a b) => HasEqAsymmetric a b where
- type EqCompareType a b
- equalTo :: a -> b -> EqCompareType a b
- notEqualTo :: a -> b -> EqCompareType a b
- (==) :: HasEqAsymmetric a b => a -> b -> EqCompareType a b
- (/=) :: HasEqAsymmetric a b => a -> b -> EqCompareType a b
- type HasEqCertainly t1 t2 = (HasEq t1 t2, CanTestCertainly (EqCompareType t1 t2))
- type HasEqCertainlyAsymmetric t1 t2 = (HasEqAsymmetric t1 t2, CanTestCertainly (EqCompareType t1 t2))
- type HasEqCertainlyCE es t1 t2 = (HasEqCertainly t1 t2, HasEqCertainly (EnsureCE es t1) (EnsureCE es t2))
- type HasEqCertainlyCN t1 t2 = HasEqCertainlyCE NumErrors t1 t2
- notCertainlyDifferentFrom :: HasEqCertainlyAsymmetric a b => a -> b -> Bool
- certainlyEqualTo :: HasEqCertainlyAsymmetric a b => a -> b -> Bool
- certainlyNotEqualTo :: HasEqCertainlyAsymmetric a b => a -> b -> Bool
- (?==?) :: HasEqCertainlyAsymmetric a b => a -> b -> Bool
- (!==!) :: HasEqCertainlyAsymmetric a b => a -> b -> Bool
- (!/=!) :: HasEqCertainlyAsymmetric a b => a -> b -> Bool
- specHasEq :: (Show t1, Show t2, Show t3, Arbitrary t1, Arbitrary t2, Arbitrary t3, CanTestCertainly (EqCompareType t1 t1), CanTestCertainly (EqCompareType t1 t2), CanTestCertainly (EqCompareType t2 t1), CanTestCertainly (EqCompareType t2 t3), CanTestCertainly (AndOrType (EqCompareType t1 t2) (EqCompareType t2 t3)), CanAndOrAsymmetric (EqCompareType t1 t2) (EqCompareType t2 t3), HasEqAsymmetric t1 t1, HasEqAsymmetric t1 t2, HasEqAsymmetric t2 t1, HasEqAsymmetric t2 t3) => T t1 -> T t2 -> T t3 -> Spec
- specHasEqNotMixed :: (Show t, Arbitrary t, CanTestCertainly (EqCompareType t t), CanTestCertainly (AndOrType (EqCompareType t t) (EqCompareType t t)), HasEqAsymmetric t t) => T t -> Spec
- specConversion :: (Arbitrary t1, Show t1, HasEqCertainly t1 t1) => T t1 -> T t2 -> (t1 -> t2) -> (t2 -> t1) -> Spec
- class CanTestNaN t where
- class CanTestFinite t where
- isInfinite :: t -> Bool
- isFinite :: t -> Bool
- class CanTestInteger t where
- certainlyNotInteger :: t -> Bool
- certainlyInteger :: t -> Bool
- certainlyIntegerGetIt :: t -> Maybe Integer
- class CanTestZero t where
- isCertainlyZero :: t -> Bool
- isCertainlyNonZero :: t -> Bool
- specCanTestZero :: (CanTestZero t, ConvertibleExactly Integer t) => T t -> Spec
- class CanPickNonZero t where
- pickNonZero :: [(t, s)] -> Maybe (t, s)
- specCanPickNonZero :: (CanPickNonZero t, CanTestZero t, ConvertibleExactly Integer t, Show t, Arbitrary t) => T t -> Spec
Equality checks
type HasEq t1 t2 = (HasEqAsymmetric t1 t2, HasEqAsymmetric t2 t1, EqCompareType t1 t2 ~ EqCompareType t2 t1) Source #
class IsBool (EqCompareType a b) => HasEqAsymmetric a b where Source #
Nothing
type EqCompareType a b Source #
equalTo :: a -> b -> EqCompareType a b Source #
equalTo :: (EqCompareType a b ~ Bool, a ~ b, Eq a) => a -> b -> EqCompareType a b Source #
notEqualTo :: a -> b -> EqCompareType a b Source #
notEqualTo :: CanNegSameType (EqCompareType a b) => a -> b -> EqCompareType a b Source #
Instances
(==) :: HasEqAsymmetric a b => a -> b -> EqCompareType a b infix 4 Source #
(/=) :: HasEqAsymmetric a b => a -> b -> EqCompareType a b infix 4 Source #
type HasEqCertainly t1 t2 = (HasEq t1 t2, CanTestCertainly (EqCompareType t1 t2)) Source #
type HasEqCertainlyAsymmetric t1 t2 = (HasEqAsymmetric t1 t2, CanTestCertainly (EqCompareType t1 t2)) Source #
type HasEqCertainlyCE es t1 t2 = (HasEqCertainly t1 t2, HasEqCertainly (EnsureCE es t1) (EnsureCE es t2)) Source #
type HasEqCertainlyCN t1 t2 = HasEqCertainlyCE NumErrors t1 t2 Source #
notCertainlyDifferentFrom :: HasEqCertainlyAsymmetric a b => a -> b -> Bool Source #
certainlyEqualTo :: HasEqCertainlyAsymmetric a b => a -> b -> Bool Source #
certainlyNotEqualTo :: HasEqCertainlyAsymmetric a b => a -> b -> Bool Source #
(?==?) :: HasEqCertainlyAsymmetric a b => a -> b -> Bool infix 4 Source #
(!==!) :: HasEqCertainlyAsymmetric a b => a -> b -> Bool infix 4 Source #
(!/=!) :: HasEqCertainlyAsymmetric a b => a -> b -> Bool infix 4 Source #
Tests
specHasEq :: (Show t1, Show t2, Show t3, Arbitrary t1, Arbitrary t2, Arbitrary t3, CanTestCertainly (EqCompareType t1 t1), CanTestCertainly (EqCompareType t1 t2), CanTestCertainly (EqCompareType t2 t1), CanTestCertainly (EqCompareType t2 t3), CanTestCertainly (AndOrType (EqCompareType t1 t2) (EqCompareType t2 t3)), CanAndOrAsymmetric (EqCompareType t1 t2) (EqCompareType t2 t3), HasEqAsymmetric t1 t1, HasEqAsymmetric t1 t2, HasEqAsymmetric t2 t1, HasEqAsymmetric t2 t3) => T t1 -> T t2 -> T t3 -> Spec Source #
HSpec properties that each implementation of HasEq should satisfy.
specHasEqNotMixed :: (Show t, Arbitrary t, CanTestCertainly (EqCompareType t t), CanTestCertainly (AndOrType (EqCompareType t t) (EqCompareType t t)), HasEqAsymmetric t t) => T t -> Spec Source #
HSpec properties that each implementation of HasEq should satisfy.
specConversion :: (Arbitrary t1, Show t1, HasEqCertainly t1 t1) => T t1 -> T t2 -> (t1 -> t2) -> (t2 -> t1) -> Spec Source #
HSpec property of there-and-back conversion.
Specific comparisons
class CanTestNaN t where Source #
Nothing
Instances
CanTestNaN Double Source # | |
CanTestNaN Integer Source # | |
CanTestNaN Rational Source # | |
(CanTestNaN t, SuitableForCE es) => CanTestNaN (CollectErrors es t) Source # | |
Defined in Numeric.MixedTypes.Eq isNaN :: CollectErrors es t -> Bool Source # |
class CanTestFinite t where Source #
Nothing
isInfinite :: t -> Bool Source #
isInfinite :: RealFloat t => t -> Bool Source #
Instances
CanTestFinite Double Source # | |
CanTestFinite Integer Source # | |
CanTestFinite Rational Source # | |
(CanTestFinite t, SuitableForCE es) => CanTestFinite (CollectErrors es t) Source # | |
Defined in Numeric.MixedTypes.Eq isInfinite :: CollectErrors es t -> Bool Source # isFinite :: CollectErrors es t -> Bool Source # |
class CanTestInteger t where Source #
certainlyNotInteger :: t -> Bool Source #
certainlyInteger :: t -> Bool Source #
certainlyIntegerGetIt :: t -> Maybe Integer Source #
Instances
CanTestInteger Double Source # | |
Defined in Numeric.MixedTypes.Eq | |
CanTestInteger Int Source # | |
Defined in Numeric.MixedTypes.Eq | |
CanTestInteger Integer Source # | |
Defined in Numeric.MixedTypes.Eq | |
CanTestInteger Rational Source # | |
Defined in Numeric.MixedTypes.Eq | |
(CanTestInteger t, CanTestZero t) => CanTestInteger (Complex t) Source # | |
Defined in Numeric.MixedTypes.Complex | |
(CanTestInteger t, SuitableForCE es) => CanTestInteger (CollectErrors es t) Source # | |
Defined in Numeric.MixedTypes.Eq certainlyNotInteger :: CollectErrors es t -> Bool Source # certainlyInteger :: CollectErrors es t -> Bool Source # certainlyIntegerGetIt :: CollectErrors es t -> Maybe Integer Source # |
class CanTestZero t where Source #
Nothing
isCertainlyZero :: t -> Bool Source #
isCertainlyNonZero :: t -> Bool Source #
isCertainlyZero :: HasEqCertainly t Integer => t -> Bool Source #
isCertainlyNonZero :: HasEqCertainly t Integer => t -> Bool Source #
Instances
CanTestZero Double Source # | |
Defined in Numeric.MixedTypes.Eq isCertainlyZero :: Double -> Bool Source # isCertainlyNonZero :: Double -> Bool Source # | |
CanTestZero Int Source # | |
Defined in Numeric.MixedTypes.Eq isCertainlyZero :: Int -> Bool Source # isCertainlyNonZero :: Int -> Bool Source # | |
CanTestZero Integer Source # | |
Defined in Numeric.MixedTypes.Eq isCertainlyZero :: Integer -> Bool Source # isCertainlyNonZero :: Integer -> Bool Source # | |
CanTestZero Rational Source # | |
Defined in Numeric.MixedTypes.Eq isCertainlyZero :: Rational -> Bool Source # isCertainlyNonZero :: Rational -> Bool Source # | |
(CanTestZero t, SuitableForCE es) => CanTestZero (CollectErrors es t) Source # | |
Defined in Numeric.MixedTypes.Eq isCertainlyZero :: CollectErrors es t -> Bool Source # isCertainlyNonZero :: CollectErrors es t -> Bool Source # |
specCanTestZero :: (CanTestZero t, ConvertibleExactly Integer t) => T t -> Spec Source #
HSpec properties that each implementation of CanTestZero should satisfy.
class CanPickNonZero t where Source #
Nothing
pickNonZero :: [(t, s)] -> Maybe (t, s) Source #
Given a list [(a1,b1),(a2,b2),...]
and assuming that
at least one of a1,a2,...
is non-zero, pick one of them
and return the corresponding pair (ai,bi)
.
If none of a1,a2,...
is zero, either throws an exception
or loops forever.
The default implementation is based on a CanTestZero
instance
and is not parallel.
pickNonZero :: (CanTestZero t, Show t) => [(t, s)] -> Maybe (t, s) Source #
Given a list [(a1,b1),(a2,b2),...]
and assuming that
at least one of a1,a2,...
is non-zero, pick one of them
and return the corresponding pair (ai,bi)
.
If none of a1,a2,...
is zero, either throws an exception
or loops forever.
The default implementation is based on a CanTestZero
instance
and is not parallel.
Instances
CanPickNonZero Int Source # | |
Defined in Numeric.MixedTypes.Eq | |
CanPickNonZero Integer Source # | |
Defined in Numeric.MixedTypes.Eq | |
CanPickNonZero Rational Source # | |
Defined in Numeric.MixedTypes.Eq | |
(CanPickNonZero a, SuitableForCE es) => CanPickNonZero (CollectErrors es a) Source # | |
Defined in Numeric.MixedTypes.Eq pickNonZero :: [(CollectErrors es a, s)] -> Maybe (CollectErrors es a, s) Source # |
specCanPickNonZero :: (CanPickNonZero t, CanTestZero t, ConvertibleExactly Integer t, Show t, Arbitrary t) => T t -> Spec Source #
HSpec properties that each implementation of CanPickNonZero should satisfy.