mixed-types-num-0.5.4.0: Alternative Prelude with numeric and logic expressions typed bottom-up
Copyright(c) Michal Konecny
LicenseBSD3
Maintainermikkonecny@gmail.com
Stabilityexperimental
Portabilityportable
Safe HaskellNone
LanguageHaskell2010

Numeric.MixedTypes.Elementary

Description

 
Synopsis

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.

Minimal complete definition

Nothing

Associated Types

type SqrtType t Source #

type SqrtType t = t

Methods

sqrt :: t -> SqrtType t Source #

default sqrt :: (SqrtType t ~ t, Floating t) => t -> SqrtType t Source #

Instances

Instances details
CanSqrt Double Source # 
Instance details

Defined in Numeric.MixedTypes.Elementary

Associated Types

type SqrtType Double Source #

(CanSqrt a, CanTestPosNeg a, CanMinMaxThis a Integer) => CanSqrt (CN a) Source # 
Instance details

Defined in Numeric.MixedTypes.Elementary

Associated Types

type SqrtType (CN a) Source #

Methods

sqrt :: CN a -> SqrtType (CN a) Source #

specCanSqrtReal :: _ => T t -> Spec Source #

HSpec properties that each implementation of CanSqrt should satisfy.

Exp

class CanExp t where Source #

A replacement for Prelude's exp. If Floating t, then one can use the default implementation to mirror Prelude's exp.

Minimal complete definition

Nothing

Associated Types

type ExpType t Source #

type ExpType t = t

Methods

exp :: t -> ExpType t Source #

default exp :: (ExpType t ~ t, Floating t) => t -> ExpType t Source #

Instances

Instances details
CanExp Double Source # 
Instance details

Defined in Numeric.MixedTypes.Elementary

Associated Types

type ExpType Double Source #

(CanExp t, CanSinCos t, CanMulAsymmetric (ExpType t) (SinCosType t)) => CanExp (Complex t) Source # 
Instance details

Defined in Numeric.MixedTypes.Complex

Associated Types

type ExpType (Complex t) Source #

Methods

exp :: Complex t -> ExpType (Complex t) Source #

CanExp a => CanExp (CN a) Source # 
Instance details

Defined in Numeric.MixedTypes.Elementary

Associated Types

type ExpType (CN a) Source #

Methods

exp :: CN a -> ExpType (CN a) Source #

type CanExpSameType t = (CanExp t, ExpType t ~ t) Source #

specCanExpReal :: _ => T t -> Spec Source #

HSpec properties that each implementation of CanExp should satisfy.

Log

class CanLog t where Source #

A replacement for Prelude's log. If Floating t, then one can use the default implementation to mirror Prelude's log.

Minimal complete definition

Nothing

Associated Types

type LogType t Source #

type LogType t = t

Methods

log :: t -> LogType t Source #

default log :: (LogType t ~ t, Floating t) => t -> LogType t Source #

Instances

Instances details
CanLog Double Source # 
Instance details

Defined in Numeric.MixedTypes.Elementary

Associated Types

type LogType Double Source #

(CanLog a, CanTestPosNeg a) => CanLog (CN a) Source # 
Instance details

Defined in Numeric.MixedTypes.Elementary

Associated Types

type LogType (CN a) Source #

Methods

log :: CN a -> LogType (CN a) Source #

type CanLogSameType t = (CanLog t, LogType t ~ t) Source #

specCanLogReal :: _ => T t -> Spec Source #

HSpec properties that each implementation of CanLog should satisfy.

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.

Minimal complete definition

Nothing

Associated Types

type SinCosType t Source #

type SinCosType t = t

Methods

cos :: t -> SinCosType t Source #

default cos :: (SinCosType t ~ t, Floating t) => t -> SinCosType t Source #

sin :: t -> SinCosType t Source #

default sin :: (SinCosType t ~ t, Floating t) => t -> SinCosType t Source #

Instances

Instances details
CanSinCos Double Source # 
Instance details

Defined in Numeric.MixedTypes.Elementary

Associated Types

type SinCosType Double Source #

CanSinCos a => CanSinCos (CN a) Source # 
Instance details

Defined in Numeric.MixedTypes.Elementary

Associated Types

type SinCosType (CN a) Source #

Methods

cos :: CN a -> SinCosType (CN a) Source #

sin :: CN a -> SinCosType (CN a) Source #

specCanSinCosReal :: _ => 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.