Copyright | (c) Michal Konecny |
---|---|
License | BSD3 |
Maintainer | mikkonecny@gmail.com |
Stability | experimental |
Portability | portable |
Safe Haskell | None |
Language | Haskell98 |
- type CanAddSubMulDivCNBy t s = (CanAddSubMulBy t s, CanAddSubMulBy (EnsureCN t) s, CanDivCNBy t s)
- class (Ring t, CanDivCNSameType t, CanRecipCNSameType t, CanAddSubMulDivCNBy t Rational, CanAddSubMulDivCNBy t Integer, CanAddSubMulDivCNBy t Int) => Field t
- class (Field t, OrderedRing t, HasOrder t Rational, HasOrder (EnsureCN t) Rational) => OrderedField t
- class (Field t, OrderedCertainlyRing t, HasOrderCertainly t Rational, HasOrderCertainly (EnsureCN t) Rational) => OrderedCertainlyField t
- class CanDiv t1 t2 where
- type DivTypeNoCN t1 t2
- type DivType t1 t2
- type CanDivBy t1 t2 = (CanDiv t1 t2, DivType t1 t2 ~ t1, DivTypeNoCN t1 t2 ~ t1)
- type CanDivCNBy t1 t2 = (CanDiv t1 t2, DivType t1 t2 ~ EnsureCN t1, DivTypeNoCN t1 t2 ~ t1, CanEnsureCN t1, CanDiv (EnsureCN t1) t2, DivType (EnsureCN t1) t2 ~ EnsureCN t1, DivTypeNoCN (EnsureCN t1) t2 ~ EnsureCN t1)
- type CanDivSameType t = CanDivBy t t
- type CanDivCNSameType t = (CanDivCNBy t t, CanDiv (EnsureCN t) (EnsureCN t), DivType (EnsureCN t) (EnsureCN t) ~ EnsureCN t, DivTypeNoCN (EnsureCN t) (EnsureCN t) ~ EnsureCN t)
- type CanRecip t = CanDiv Integer t
- type CanRecipSameType t = (CanDiv Integer t, DivType Integer t ~ t, DivTypeNoCN Integer t ~ t)
- type CanRecipCNSameType t = (CanDiv Integer t, DivType Integer t ~ EnsureCN t, DivTypeNoCN Integer t ~ t, CanEnsureCN t, CanDiv Integer (EnsureCN t), DivType Integer (EnsureCN t) ~ EnsureCN t, DivTypeNoCN Integer (EnsureCN t) ~ EnsureCN t)
- (/) :: CanDiv t1 t2 => t1 -> t2 -> DivType t1 t2
- (/!) :: CanDiv t1 t2 => t1 -> t2 -> DivTypeNoCN t1 t2
- recip :: CanRecip t => t -> DivType Integer t
- powUsingMulRecip :: (CanBeInteger e, CanRecipCNSameType t, CanMulSameType t, CanEnsureCN t) => t -> t -> e -> EnsureCN t
- specCanDiv :: (Show t1, Show t2, Show (DivType Integer (DivType Integer t1)), Show (DivType t1 t2), Show (DivType t1 t1), Show (MulType t1 (DivType t1 t2)), Arbitrary t1, Arbitrary t2, ConvertibleExactly Integer t1, ConvertibleExactly Integer t2, CanTestCertainly (EqCompareType (DivType Integer (DivType Integer t1)) t1), CanTestCertainly (EqCompareType (DivType t1 t2) t1), CanTestCertainly (EqCompareType (DivType t1 t1) t1), CanTestCertainly (EqCompareType (DivType t1 t2) (MulType t1 (DivType t1 t2))), HasEqAsymmetric (DivType Integer (DivType Integer t1)) t1, HasEqAsymmetric (DivType t1 t2) t1, HasEqAsymmetric (DivType t1 t2) (MulType t1 (DivType t1 t2)), HasEqAsymmetric (DivType t1 t1) t1, CanTestZero t1, CanTestZero t2, CanTestZero (DivType Integer t1), CanMulAsymmetric t1 (DivType t1 t2), CanDiv t1 t1, CanDiv t1 t2, CanDiv Integer t1, CanDiv Integer (DivType Integer t1)) => T t1 -> T t2 -> Spec
- specCanDivNotMixed :: (Show t, Show (DivType Integer (DivType Integer t)), Show (DivType t t), Show (MulType t (DivType t t)), Arbitrary t, ConvertibleExactly Integer t, CanTestCertainly (EqCompareType (DivType Integer (DivType Integer t)) t), CanTestCertainly (EqCompareType (DivType t t) t), CanTestCertainly (EqCompareType (DivType t t) (MulType t (DivType t t))), HasEqAsymmetric (DivType Integer (DivType Integer t)) t, HasEqAsymmetric (DivType t t) t, HasEqAsymmetric (DivType t t) (MulType t (DivType t t)), CanTestZero t, CanTestZero (DivType Integer t), CanMulAsymmetric t (DivType t t), CanDiv t t, CanDiv Integer t, CanDiv Integer (DivType Integer t)) => T t -> Spec
Field
type CanAddSubMulDivCNBy t s = (CanAddSubMulBy t s, CanAddSubMulBy (EnsureCN t) s, CanDivCNBy t s) Source #
class (Ring t, CanDivCNSameType t, CanRecipCNSameType t, CanAddSubMulDivCNBy t Rational, CanAddSubMulDivCNBy t Integer, CanAddSubMulDivCNBy t Int) => Field t Source #
class (Field t, OrderedRing t, HasOrder t Rational, HasOrder (EnsureCN t) Rational) => OrderedField t Source #
class (Field t, OrderedCertainlyRing t, HasOrderCertainly t Rational, HasOrderCertainly (EnsureCN t) Rational) => OrderedCertainlyField t Source #
Division
class CanDiv t1 t2 where Source #
A replacement for Prelude's binary /
. If t1 = t2
and Fractional t1
,
then one can use the default implementation to mirror Prelude's /
.
divideNoCN :: t1 -> t2 -> DivTypeNoCN t1 t2 Source #
divide :: t1 -> t2 -> DivType t1 t2 Source #
divide :: (CanTestZero t2, CanEnsureCN (DivTypeNoCN t1 t2), DivType t1 t2 ~ EnsureCN (DivTypeNoCN t1 t2)) => t1 -> t2 -> DivType t1 t2 Source #
type CanDivCNBy t1 t2 = (CanDiv t1 t2, DivType t1 t2 ~ EnsureCN t1, DivTypeNoCN t1 t2 ~ t1, CanEnsureCN t1, CanDiv (EnsureCN t1) t2, DivType (EnsureCN t1) t2 ~ EnsureCN t1, DivTypeNoCN (EnsureCN t1) t2 ~ EnsureCN t1) Source #
type CanDivSameType t = CanDivBy t t Source #
type CanDivCNSameType t = (CanDivCNBy t t, CanDiv (EnsureCN t) (EnsureCN t), DivType (EnsureCN t) (EnsureCN t) ~ EnsureCN t, DivTypeNoCN (EnsureCN t) (EnsureCN t) ~ EnsureCN t) Source #
type CanRecipSameType t = (CanDiv Integer t, DivType Integer t ~ t, DivTypeNoCN Integer t ~ t) Source #
type CanRecipCNSameType t = (CanDiv Integer t, DivType Integer t ~ EnsureCN t, DivTypeNoCN Integer t ~ t, CanEnsureCN t, CanDiv Integer (EnsureCN t), DivType Integer (EnsureCN t) ~ EnsureCN t, DivTypeNoCN Integer (EnsureCN t) ~ EnsureCN t) Source #
(/!) :: CanDiv t1 t2 => t1 -> t2 -> DivTypeNoCN t1 t2 infixl 7 Source #
powUsingMulRecip :: (CanBeInteger e, CanRecipCNSameType t, CanMulSameType t, CanEnsureCN t) => t -> t -> e -> EnsureCN t Source #
Tests
specCanDiv :: (Show t1, Show t2, Show (DivType Integer (DivType Integer t1)), Show (DivType t1 t2), Show (DivType t1 t1), Show (MulType t1 (DivType t1 t2)), Arbitrary t1, Arbitrary t2, ConvertibleExactly Integer t1, ConvertibleExactly Integer t2, CanTestCertainly (EqCompareType (DivType Integer (DivType Integer t1)) t1), CanTestCertainly (EqCompareType (DivType t1 t2) t1), CanTestCertainly (EqCompareType (DivType t1 t1) t1), CanTestCertainly (EqCompareType (DivType t1 t2) (MulType t1 (DivType t1 t2))), HasEqAsymmetric (DivType Integer (DivType Integer t1)) t1, HasEqAsymmetric (DivType t1 t2) t1, HasEqAsymmetric (DivType t1 t2) (MulType t1 (DivType t1 t2)), HasEqAsymmetric (DivType t1 t1) t1, CanTestZero t1, CanTestZero t2, CanTestZero (DivType Integer t1), CanMulAsymmetric t1 (DivType t1 t2), CanDiv t1 t1, CanDiv t1 t2, CanDiv Integer t1, CanDiv Integer (DivType Integer t1)) => T t1 -> T t2 -> Spec Source #
HSpec properties that each implementation of CanDiv should satisfy.
specCanDivNotMixed :: (Show t, Show (DivType Integer (DivType Integer t)), Show (DivType t t), Show (MulType t (DivType t t)), Arbitrary t, ConvertibleExactly Integer t, CanTestCertainly (EqCompareType (DivType Integer (DivType Integer t)) t), CanTestCertainly (EqCompareType (DivType t t) t), CanTestCertainly (EqCompareType (DivType t t) (MulType t (DivType t t))), HasEqAsymmetric (DivType Integer (DivType Integer t)) t, HasEqAsymmetric (DivType t t) t, HasEqAsymmetric (DivType t t) (MulType t (DivType t t)), CanTestZero t, CanTestZero (DivType Integer t), CanMulAsymmetric t (DivType t t), CanDiv t t, CanDiv Integer t, CanDiv Integer (DivType Integer t)) => T t -> Spec Source #
HSpec properties that each implementation of CanDiv should satisfy.