Copyright | (c) Michal Konecny |
---|---|
License | BSD3 |
Maintainer | mikkonecny@gmail.com |
Stability | experimental |
Portability | portable |
Safe Haskell | None |
Language | Haskell98 |
- type CanAddSubMulDivBy t s = (CanAddSubMulBy t s, CanDivBy t s)
- type Field t = (Ring t, CanDivSameType t, CanRecipSameType t, CanAddSubMulDivBy t Rational, CanAddSubMulDivBy t Integer, CanAddSubMulDivBy t Int)
- type CertainlyEqField t = (Field t, CertainlyEqRing t)
- type OrderedField t = (Field t, OrderedRing t, HasOrder t Rational)
- type OrderedCertainlyField t = (CertainlyEqField t, OrderedCertainlyRing t, HasOrderCertainly t Rational)
- class CanDiv t1 t2 where
- type DivType t1 t2
- 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
- powUsingMulRecip :: (CanBeInteger e, CanRecipSameType t, CanMulSameType t, ConvertibleExactly Integer t) => t -> e -> t
- specCanDiv :: (CanRecip t1, CanRecip (DivType Integer t1), Show (DivType Integer (DivType Integer t1)), HasEqCertainly t1 (DivType Integer (DivType Integer t1)), CanTestZero (DivType Integer t1), CanDivX t1 t2, CanTestZero t1, CanTestZero t2, CanDivX t1 t1, CanMulX t1 (DivType t1 t2), ConvertibleExactly Integer t2, ConvertibleExactly Integer t1) => T t1 -> T t2 -> Spec
- specCanDivNotMixed :: (CanRecip t, CanRecip (DivType Integer t), Show (DivType Integer (DivType Integer t)), HasEqCertainly t (DivType Integer (DivType Integer t)), CanTestZero (DivType Integer t), CanDivX t t, CanTestZero t, CanMulX t (DivType t t), ConvertibleExactly Integer t) => T t -> Spec
- type CanDivX t1 t2 = (CanDiv t1 t2, Show t1, Arbitrary t1, Show t2, Arbitrary t2, Show (DivType t1 t2), HasEqCertainly t1 (DivType t1 t2))
Field
type CanAddSubMulDivBy t s = (CanAddSubMulBy t s, CanDivBy t s) Source #
type Field t = (Ring t, CanDivSameType t, CanRecipSameType t, CanAddSubMulDivBy t Rational, CanAddSubMulDivBy t Integer, CanAddSubMulDivBy t Int) Source #
type CertainlyEqField t = (Field t, CertainlyEqRing t) Source #
type OrderedField t = (Field t, OrderedRing t, HasOrder t Rational) Source #
type OrderedCertainlyField t = (CertainlyEqField t, OrderedCertainlyRing t, HasOrderCertainly t Rational) 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 /
.
divide :: t1 -> t2 -> DivType t1 t2 Source #
divide :: (DivType t1 t2 ~ t1, t1 ~ t2, Fractional t1) => t1 -> t1 -> t1 Source #
CanDiv Double Double Source # | |
CanDiv Double Int Source # | |
CanDiv Double Integer Source # | |
CanDiv Double Rational Source # | |
CanDiv Int Double Source # | |
CanDiv Int Int Source # | |
CanDiv Int Integer Source # | |
CanDiv Int Rational Source # | |
CanDiv Integer Double Source # | |
CanDiv Integer Int Source # | |
CanDiv Integer Integer Source # | |
CanDiv Integer Rational Source # | |
CanDiv Rational Double Source # | |
CanDiv Rational Int Source # | |
CanDiv Rational Integer Source # | |
CanDiv Rational Rational Source # | |
CanDiv a b => CanDiv [a] [b] Source # | |
CanDiv a b => CanDiv (Maybe a) (Maybe b) Source # | |
type CanDivSameType t = CanDivBy t t Source #
powUsingMulRecip :: (CanBeInteger e, CanRecipSameType t, CanMulSameType t, ConvertibleExactly Integer t) => t -> e -> t Source #
Tests
specCanDiv :: (CanRecip t1, CanRecip (DivType Integer t1), Show (DivType Integer (DivType Integer t1)), HasEqCertainly t1 (DivType Integer (DivType Integer t1)), CanTestZero (DivType Integer t1), CanDivX t1 t2, CanTestZero t1, CanTestZero t2, CanDivX t1 t1, CanMulX t1 (DivType t1 t2), ConvertibleExactly Integer t2, ConvertibleExactly Integer t1) => T t1 -> T t2 -> Spec Source #
HSpec properties that each implementation of CanDiv should satisfy.
specCanDivNotMixed :: (CanRecip t, CanRecip (DivType Integer t), Show (DivType Integer (DivType Integer t)), HasEqCertainly t (DivType Integer (DivType Integer t)), CanTestZero (DivType Integer t), CanDivX t t, CanTestZero t, CanMulX t (DivType t t), ConvertibleExactly Integer t) => T t -> Spec Source #
HSpec properties that each implementation of CanDiv should satisfy.