Copyright | (c) Michal Konecny |
---|---|
License | BSD3 |
Maintainer | [email protected] |
Stability | experimental |
Portability | portable |
Safe Haskell | None |
Language | Haskell2010 |
Numeric.MixedTypes.Ord
Description
Synopsis
- type HasOrder t1 t2 = (HasOrderAsymmetric t1 t2, HasOrderAsymmetric t2 t1, OrderCompareType t1 t2 ~ OrderCompareType t2 t1)
- class IsBool (OrderCompareType a b) => HasOrderAsymmetric a b where
- type OrderCompareType a b
- lessThan :: a -> b -> OrderCompareType a b
- greaterThan :: a -> b -> OrderCompareType a b
- leq :: a -> b -> OrderCompareType a b
- geq :: a -> b -> OrderCompareType a b
- (>) :: HasOrderAsymmetric a b => a -> b -> OrderCompareType a b
- (<) :: HasOrderAsymmetric a b => a -> b -> OrderCompareType a b
- (<=) :: HasOrderAsymmetric a b => a -> b -> OrderCompareType a b
- (>=) :: HasOrderAsymmetric a b => a -> b -> OrderCompareType a b
- type HasOrderCertainlyAsymmetric t1 t2 = (HasOrderAsymmetric t1 t2, CanTestCertainly (OrderCompareType t1 t2))
- type HasOrderCertainly t1 t2 = (HasOrder t1 t2, CanTestCertainly (OrderCompareType t1 t2))
- (?<=?) :: HasOrderCertainlyAsymmetric a b => a -> b -> Bool
- (?<?) :: HasOrderCertainlyAsymmetric a b => a -> b -> Bool
- (?>=?) :: HasOrderCertainlyAsymmetric a b => a -> b -> Bool
- (?>?) :: HasOrderCertainlyAsymmetric a b => a -> b -> Bool
- (!<=!) :: HasOrderCertainlyAsymmetric a b => a -> b -> Bool
- (!<!) :: HasOrderCertainlyAsymmetric a b => a -> b -> Bool
- (!>=!) :: HasOrderCertainlyAsymmetric a b => a -> b -> Bool
- (!>!) :: HasOrderCertainlyAsymmetric a b => a -> b -> Bool
- specHasOrder :: (Arbitrary t1, Arbitrary t2, Arbitrary t3, Show t1, Show t2, Show t3, CanTestCertainly (AndOrType (OrderCompareType t1 t2) (OrderCompareType t2 t3)), CanTestCertainly (OrderCompareType t1 t1), CanTestCertainly (OrderCompareType t1 t2), CanTestCertainly (OrderCompareType t2 t1), CanTestCertainly (OrderCompareType t2 t3), HasOrderAsymmetric t1 t1, HasOrderAsymmetric t1 t2, HasOrderAsymmetric t2 t1, HasOrderAsymmetric t2 t3, CanAndOrAsymmetric (OrderCompareType t1 t2) (OrderCompareType t2 t3)) => T t1 -> T t2 -> T t3 -> Spec
- specHasOrderNotMixed :: (Arbitrary t, Show t, CanTestCertainly (OrderCompareType t t), HasOrderAsymmetric t t) => T t -> Spec
- class CanTestPosNeg t where
- isCertainlyPositive :: t -> Bool
- isCertainlyNonNegative :: t -> Bool
- isCertainlyNegative :: t -> Bool
- isCertainlyNonPositive :: t -> Bool
Comparisons in numeric order
type HasOrder t1 t2 = (HasOrderAsymmetric t1 t2, HasOrderAsymmetric t2 t1, OrderCompareType t1 t2 ~ OrderCompareType t2 t1) Source #
class IsBool (OrderCompareType a b) => HasOrderAsymmetric a b where Source #
Minimal complete definition
Nothing
Methods
lessThan :: a -> b -> OrderCompareType a b Source #
default lessThan :: (OrderCompareType a b ~ Bool, a ~ b, Ord a) => a -> b -> OrderCompareType a b Source #
greaterThan :: a -> b -> OrderCompareType a b Source #
default greaterThan :: (HasOrder b a, OrderCompareType b a ~ OrderCompareType a b) => a -> b -> OrderCompareType a b Source #
leq :: a -> b -> OrderCompareType a b Source #
default leq :: (OrderCompareType a b ~ Bool, a ~ b, Ord a) => a -> b -> OrderCompareType a b Source #
geq :: a -> b -> OrderCompareType a b Source #
default geq :: (HasOrder b a, OrderCompareType b a ~ OrderCompareType a b) => a -> b -> OrderCompareType a b Source #
Instances
(>) :: HasOrderAsymmetric a b => a -> b -> OrderCompareType a b infix 4 Source #
(<) :: HasOrderAsymmetric a b => a -> b -> OrderCompareType a b infix 4 Source #
(<=) :: HasOrderAsymmetric a b => a -> b -> OrderCompareType a b infix 4 Source #
(>=) :: HasOrderAsymmetric a b => a -> b -> OrderCompareType a b infix 4 Source #
type HasOrderCertainlyAsymmetric t1 t2 = (HasOrderAsymmetric t1 t2, CanTestCertainly (OrderCompareType t1 t2)) Source #
type HasOrderCertainly t1 t2 = (HasOrder t1 t2, CanTestCertainly (OrderCompareType t1 t2)) Source #
(?<=?) :: HasOrderCertainlyAsymmetric a b => a -> b -> Bool infix 4 Source #
(?<?) :: HasOrderCertainlyAsymmetric a b => a -> b -> Bool infix 4 Source #
(?>=?) :: HasOrderCertainlyAsymmetric a b => a -> b -> Bool infix 4 Source #
(?>?) :: HasOrderCertainlyAsymmetric a b => a -> b -> Bool infix 4 Source #
(!<=!) :: HasOrderCertainlyAsymmetric a b => a -> b -> Bool infix 4 Source #
(!<!) :: HasOrderCertainlyAsymmetric a b => a -> b -> Bool infix 4 Source #
(!>=!) :: HasOrderCertainlyAsymmetric a b => a -> b -> Bool infix 4 Source #
(!>!) :: HasOrderCertainlyAsymmetric a b => a -> b -> Bool infix 4 Source #
Tests
specHasOrder :: (Arbitrary t1, Arbitrary t2, Arbitrary t3, Show t1, Show t2, Show t3, CanTestCertainly (AndOrType (OrderCompareType t1 t2) (OrderCompareType t2 t3)), CanTestCertainly (OrderCompareType t1 t1), CanTestCertainly (OrderCompareType t1 t2), CanTestCertainly (OrderCompareType t2 t1), CanTestCertainly (OrderCompareType t2 t3), HasOrderAsymmetric t1 t1, HasOrderAsymmetric t1 t2, HasOrderAsymmetric t2 t1, HasOrderAsymmetric t2 t3, CanAndOrAsymmetric (OrderCompareType t1 t2) (OrderCompareType t2 t3)) => T t1 -> T t2 -> T t3 -> Spec Source #
HSpec properties that each implementation of HasOrder
should satisfy.
specHasOrderNotMixed :: (Arbitrary t, Show t, CanTestCertainly (OrderCompareType t t), HasOrderAsymmetric t t) => T t -> Spec Source #
HSpec properties that each implementation of HasOrder
should satisfy.
Specific comparisons
class CanTestPosNeg t where Source #
Minimal complete definition
Nothing
Methods
isCertainlyPositive :: t -> Bool Source #
default isCertainlyPositive :: HasOrderCertainly t Integer => t -> Bool Source #
isCertainlyNonNegative :: t -> Bool Source #
default isCertainlyNonNegative :: HasOrderCertainly t Integer => t -> Bool Source #
isCertainlyNegative :: t -> Bool Source #
default isCertainlyNegative :: HasOrderCertainly t Integer => t -> Bool Source #
isCertainlyNonPositive :: t -> Bool Source #
default isCertainlyNonPositive :: HasOrderCertainly t Integer => t -> Bool Source #
Instances
CanTestPosNeg Rational Source # | |
Defined in Numeric.MixedTypes.Ord Methods isCertainlyPositive :: Rational -> Bool Source # isCertainlyNonNegative :: Rational -> Bool Source # isCertainlyNegative :: Rational -> Bool Source # | |
CanTestPosNeg Integer Source # | |
Defined in Numeric.MixedTypes.Ord Methods isCertainlyPositive :: Integer -> Bool Source # isCertainlyNonNegative :: Integer -> Bool Source # isCertainlyNegative :: Integer -> Bool Source # isCertainlyNonPositive :: Integer -> Bool Source # | |
CanTestPosNeg Double Source # | |
Defined in Numeric.MixedTypes.Ord Methods isCertainlyPositive :: Double -> Bool Source # isCertainlyNonNegative :: Double -> Bool Source # isCertainlyNegative :: Double -> Bool Source # isCertainlyNonPositive :: Double -> Bool Source # | |
CanTestPosNeg Int Source # | |
Defined in Numeric.MixedTypes.Ord Methods isCertainlyPositive :: Int -> Bool Source # isCertainlyNonNegative :: Int -> Bool Source # isCertainlyNegative :: Int -> Bool Source # isCertainlyNonPositive :: Int -> Bool Source # | |
(CanTestPosNeg t, CanBeErrors es) => CanTestPosNeg (CollectErrors es t) Source # | |
Defined in Numeric.MixedTypes.Ord Methods isCertainlyPositive :: CollectErrors es t -> Bool Source # isCertainlyNonNegative :: CollectErrors es t -> Bool Source # isCertainlyNegative :: CollectErrors es t -> Bool Source # isCertainlyNonPositive :: CollectErrors es t -> Bool Source # |