Copyright | (c) Michal Konecny |
---|---|
License | BSD3 |
Maintainer | mikkonecny@gmail.com |
Stability | experimental |
Portability | portable |
Safe Haskell | None |
Language | Haskell98 |
- class CanSqrt t where
- type SqrtType t
- type CanSqrtSameType t = (CanSqrt t, SqrtType t ~ t)
- specCanSqrtReal :: (CanSqrtX t, CanPowX (SqrtType t) Integer, HasEqCertainly t (PowType (SqrtType t) Integer)) => T t -> Spec
- class CanExp t where
- type ExpType t
- type CanExpSameType t = (CanExp t, ExpType t ~ t)
- specCanExpReal :: CanExpX t => T t -> Spec
- class CanLog t where
- type LogType t
- type CanLogSameType t = (CanLog t, LogType t ~ t)
- specCanLogReal :: (CanLogX t, CanLogX (DivType Integer t), CanExp t, CanLogX (ExpType t), HasEqCertainly t (LogType (ExpType t))) => T t -> Spec
- powUsingExpLog :: (CanTestPosNeg t1, CanMulSameType t1, HasIntegers t1, CanTestZero t1, CanRecipSameType t1, CanTestInteger t2, CanTestPosNeg t2, CanMulAsymmetric (LogType t1) t2, CanLog t1, CanExp (MulType (LogType t1) t2), ExpType (MulType (LogType t1) t2) ~ t1) => t1 -> t2 -> ExpType (MulType (LogType t1) t2)
- class CanSinCos t where
- type SinCosType t
- type CanSinCosSameType t = (CanSinCos t, SinCosType t ~ t)
- specCanSinCosReal :: CanSinCosX t => T t -> Spec
- approxPi :: Floating t => t
Square root
class CanSqrt t where Source #
A replacement for Prelude's sqrt
. If Floating t
,
then one can use the default implementation to mirror Prelude's sqrt
.
type CanSqrtSameType t = (CanSqrt t, SqrtType t ~ t) Source #
specCanSqrtReal :: (CanSqrtX t, CanPowX (SqrtType t) Integer, HasEqCertainly t (PowType (SqrtType t) Integer)) => T t -> Spec Source #
HSpec properties that each implementation of CanSqrt should satisfy.
Exp
A replacement for Prelude's exp
. If Floating t
,
then one can use the default implementation to mirror Prelude's exp
.
type CanExpSameType t = (CanExp t, ExpType t ~ t) Source #
specCanExpReal :: CanExpX t => T t -> Spec Source #
HSpec properties that each implementation of CanExp should satisfy.
Log
A replacement for Prelude's log
. If Floating t
,
then one can use the default implementation to mirror Prelude's log
.
type CanLogSameType t = (CanLog t, LogType t ~ t) Source #
specCanLogReal :: (CanLogX t, CanLogX (DivType Integer t), CanExp t, CanLogX (ExpType t), HasEqCertainly t (LogType (ExpType t))) => T t -> Spec Source #
HSpec properties that each implementation of CanLog should satisfy.
powUsingExpLog :: (CanTestPosNeg t1, CanMulSameType t1, HasIntegers t1, CanTestZero t1, CanRecipSameType t1, CanTestInteger t2, CanTestPosNeg t2, CanMulAsymmetric (LogType t1) t2, CanLog t1, CanExp (MulType (LogType t1) t2), ExpType (MulType (LogType t1) t2) ~ t1) => t1 -> t2 -> ExpType (MulType (LogType t1) t2) Source #
Sine and cosine
class CanSinCos t where Source #
A replacement for Prelude's cos
and sin
. If Floating t
,
then one can use the default implementation to mirror Prelude's sin
, cos
.
type SinCosType t Source #
cos :: t -> SinCosType t Source #
cos :: (SinCosType t ~ t, Floating t) => t -> t Source #
sin :: t -> SinCosType t Source #
sin :: (SinCosType t ~ t, Floating t) => t -> t Source #
type CanSinCosSameType t = (CanSinCos t, SinCosType t ~ t) Source #
specCanSinCosReal :: CanSinCosX t => T t -> Spec Source #
HSpec properties that each implementation of CanSinCos should satisfy.
Derived partially from http://math.stackexchange.com/questions/1303044/axiomatic-definition-of-sin-and-cos
approxPi :: Floating t => t Source #
Approximate pi, synonym for Prelude's pi
.
We do not define (exect) pi
in this package as we have no type
that can represent it exactly.