Copyright | (c) Michal Konecny |
---|---|
License | BSD3 |
Maintainer | [email protected] |
Stability | experimental |
Portability | portable |
Safe Haskell | None |
Language | Haskell2010 |
Numeric.MixedTypes.Div
Description
Synopsis
- class CanDiv t1 t2 where
- type CanDivBy t1 t2 = (CanDiv t1 t2, DivType t1 t2 ~ t1)
- type CanDivSameType t = CanDivBy t t
- type CanRecip t = CanDiv Integer t
- type CanRecipSameType t = (CanDiv Integer t, DivType Integer t ~ t)
- (/) :: CanDiv t1 t2 => t1 -> t2 -> DivType t1 t2
- recip :: CanRecip t => t -> DivType Integer t
- specCanDiv :: (Arbitrary t1, Arbitrary t2, Arbitrary (DivType t1 t1), CanDiv t1 t2, CanDiv t1 t1, CanRecip t1, CanRecip (DivType Integer t1), CanTestZero t1, CanTestZero t2, CanTestZero (DivType Integer t1), HasEqAsymmetric (DivType t1 t1) (DivType t1 t1), HasEqAsymmetric (DivType t1 t2) t1, HasEqAsymmetric (DivType t1 t2) (MulType t1 (DivType t1 t2)), HasEqAsymmetric (DivType Integer (DivType Integer t1)) t1, CanTestCertainly (EqCompareType (DivType t1 t1) (DivType t1 t1)), CanTestCertainly (EqCompareType (DivType t1 t2) t1), CanTestCertainly (EqCompareType (DivType t1 t2) (MulType t1 (DivType t1 t2))), CanTestCertainly (EqCompareType (DivType Integer (DivType Integer t1)) t1), Show t1, Show t2, Show (DivType t1 t2), Show (DivType t1 t1), Show (DivType Integer (DivType Integer t1)), Show (MulType t1 (DivType t1 t2)), CanMulAsymmetric t1 (DivType t1 t2), ConvertibleExactlyWithSample Integer t2, ConvertibleExactlyWithSample Integer t1, ConvertibleExactlyWithSample Integer (DivType t1 t1)) => T t1 -> T t2 -> Spec
- specCanDivNotMixed :: (Arbitrary t, Arbitrary (DivType t t), CanDiv t t, CanRecip t, CanRecip (DivType Integer t), CanTestZero t, CanTestZero (DivType Integer t), HasEqAsymmetric (DivType t t) t, HasEqAsymmetric (DivType t t) (DivType t t), HasEqAsymmetric (DivType t t) (MulType t (DivType t t)), HasEqAsymmetric (DivType Integer (DivType Integer t)) t, CanTestCertainly (EqCompareType (DivType t t) t), CanTestCertainly (EqCompareType (DivType t t) (DivType t t)), CanTestCertainly (EqCompareType (DivType t t) (MulType t (DivType t t))), CanTestCertainly (EqCompareType (DivType Integer (DivType Integer t)) t), Show t, Show (DivType t t), Show (DivType Integer (DivType Integer t)), Show (MulType t (DivType t t)), CanMulAsymmetric t (DivType t t), ConvertibleExactlyWithSample Integer t, ConvertibleExactlyWithSample Integer (DivType t t)) => T t -> Spec
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 /
.
Instances
type CanDivSameType t = CanDivBy t t Source #
Tests
specCanDiv :: (Arbitrary t1, Arbitrary t2, Arbitrary (DivType t1 t1), CanDiv t1 t2, CanDiv t1 t1, CanRecip t1, CanRecip (DivType Integer t1), CanTestZero t1, CanTestZero t2, CanTestZero (DivType Integer t1), HasEqAsymmetric (DivType t1 t1) (DivType t1 t1), HasEqAsymmetric (DivType t1 t2) t1, HasEqAsymmetric (DivType t1 t2) (MulType t1 (DivType t1 t2)), HasEqAsymmetric (DivType Integer (DivType Integer t1)) t1, CanTestCertainly (EqCompareType (DivType t1 t1) (DivType t1 t1)), CanTestCertainly (EqCompareType (DivType t1 t2) t1), CanTestCertainly (EqCompareType (DivType t1 t2) (MulType t1 (DivType t1 t2))), CanTestCertainly (EqCompareType (DivType Integer (DivType Integer t1)) t1), Show t1, Show t2, Show (DivType t1 t2), Show (DivType t1 t1), Show (DivType Integer (DivType Integer t1)), Show (MulType t1 (DivType t1 t2)), CanMulAsymmetric t1 (DivType t1 t2), ConvertibleExactlyWithSample Integer t2, ConvertibleExactlyWithSample Integer t1, ConvertibleExactlyWithSample Integer (DivType t1 t1)) => T t1 -> T t2 -> Spec Source #
HSpec properties that each implementation of CanDiv should satisfy.
specCanDivNotMixed :: (Arbitrary t, Arbitrary (DivType t t), CanDiv t t, CanRecip t, CanRecip (DivType Integer t), CanTestZero t, CanTestZero (DivType Integer t), HasEqAsymmetric (DivType t t) t, HasEqAsymmetric (DivType t t) (DivType t t), HasEqAsymmetric (DivType t t) (MulType t (DivType t t)), HasEqAsymmetric (DivType Integer (DivType Integer t)) t, CanTestCertainly (EqCompareType (DivType t t) t), CanTestCertainly (EqCompareType (DivType t t) (DivType t t)), CanTestCertainly (EqCompareType (DivType t t) (MulType t (DivType t t))), CanTestCertainly (EqCompareType (DivType Integer (DivType Integer t)) t), Show t, Show (DivType t t), Show (DivType Integer (DivType Integer t)), Show (MulType t (DivType t t)), CanMulAsymmetric t (DivType t t), ConvertibleExactlyWithSample Integer t, ConvertibleExactlyWithSample Integer (DivType t t)) => T t -> Spec Source #
HSpec properties that each implementation of CanDiv should satisfy.