Copyright | (c) Michal Konecny |
---|---|
License | BSD3 |
Maintainer | [email protected] |
Stability | experimental |
Portability | portable |
Safe Haskell | None |
Language | Haskell2010 |
Numeric.MixedTypes.Power
Contents
Description
Synopsis
- class CanPow b e where
- type CanPowBy t1 t2 = (CanPow t1 t2, PowType t1 t2 ~ t1)
- (^) :: CanPow t1 t2 => t1 -> t2 -> PowType t1 t2
- (^^) :: CanPow t1 t2 => t1 -> t2 -> PPowType t1 t2
- powUsingMul :: CanBeInteger e => t -> (t -> t -> t) -> t -> e -> t
- integerPowCN :: (HasOrderCertainly b Integer, HasOrderCertainly e Integer, HasEqCertainly b Integer, HasEqCertainly e Integer) => (b -> e -> r) -> CN b -> CN e -> CN r
- powUsingMulRecip :: CanBeInteger e => t -> (t -> t -> t) -> (t -> t) -> t -> e -> t
- class CanTestIsIntegerType t where
- isIntegerType :: t -> Bool
- specCanPow :: (Arbitrary t1, Arbitrary t2, CanTestPosNeg t2, HasEqAsymmetric (PowType t1 t2) t1, HasEqAsymmetric (MulType t1 (PowType t1 t2)) (PowType t1 (AddType t2 Integer)), CanTestCertainly (EqCompareType (PowType t1 t2) t1), CanTestCertainly (EqCompareType (MulType t1 (PowType t1 t2)) (PowType t1 (AddType t2 Integer))), Show t1, Show t2, Show (MulType t1 (PowType t1 t2)), Show (PowType t1 t2), Show (PowType t1 (AddType t2 Integer)), CanMulAsymmetric t1 (PowType t1 t2), CanPow t1 t2, CanPow t1 (AddType t2 Integer), CanAddAsymmetric t2 Integer, ConvertibleExactlyWithSample Integer t1, ConvertibleExactlyWithSample Integer t2) => T t1 -> T t2 -> Spec
Exponentiation
class CanPow b e where Source #
Minimal complete definition
Associated Types
type PowType b e = b
Instances
powUsingMul :: CanBeInteger e => t -> (t -> t -> t) -> t -> e -> t Source #
integerPowCN :: (HasOrderCertainly b Integer, HasOrderCertainly e Integer, HasEqCertainly b Integer, HasEqCertainly e Integer) => (b -> e -> r) -> CN b -> CN e -> CN r Source #
powUsingMulRecip :: CanBeInteger e => t -> (t -> t -> t) -> (t -> t) -> t -> e -> t Source #
class CanTestIsIntegerType t where Source #
Ability to detect whether a numeric type is restricted to (a subset of) integers.
This is useful eg when checking the arguments of the power operator in the CN instance for power.
Minimal complete definition
Nothing
Methods
isIntegerType :: t -> Bool Source #
Instances
CanTestIsIntegerType Rational Source # | |
Defined in Numeric.MixedTypes.Power Methods isIntegerType :: Rational -> Bool Source # | |
CanTestIsIntegerType Integer Source # | |
Defined in Numeric.MixedTypes.Power Methods isIntegerType :: Integer -> Bool Source # | |
CanTestIsIntegerType Double Source # | |
Defined in Numeric.MixedTypes.Power Methods isIntegerType :: Double -> Bool Source # | |
CanTestIsIntegerType Int Source # | |
Defined in Numeric.MixedTypes.Power Methods isIntegerType :: Int -> Bool Source # | |
CanTestIsIntegerType t => CanTestIsIntegerType (CN t) Source # | |
Defined in Numeric.MixedTypes.Power Methods isIntegerType :: CN t -> Bool Source # |
Tests
specCanPow :: (Arbitrary t1, Arbitrary t2, CanTestPosNeg t2, HasEqAsymmetric (PowType t1 t2) t1, HasEqAsymmetric (MulType t1 (PowType t1 t2)) (PowType t1 (AddType t2 Integer)), CanTestCertainly (EqCompareType (PowType t1 t2) t1), CanTestCertainly (EqCompareType (MulType t1 (PowType t1 t2)) (PowType t1 (AddType t2 Integer))), Show t1, Show t2, Show (MulType t1 (PowType t1 t2)), Show (PowType t1 t2), Show (PowType t1 (AddType t2 Integer)), CanMulAsymmetric t1 (PowType t1 t2), CanPow t1 t2, CanPow t1 (AddType t2 Integer), CanAddAsymmetric t2 Integer, ConvertibleExactlyWithSample Integer t1, ConvertibleExactlyWithSample Integer t2) => T t1 -> T t2 -> Spec Source #
HSpec properties that each implementation of CanPow should satisfy.