mixed-types-num-0.1.0.0: Alternative Prelude with numeric and logic expressions typed bottom-up

Copyright(c) Michal Konecny
LicenseBSD3
Maintainermikkonecny@gmail.com
Stabilityexperimental
Portabilityportable
Safe HaskellNone
LanguageHaskell98

Numeric.MixedTypes.Elementary

Contents

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.

Associated Types

type SqrtType t Source #

Methods

sqrt :: t -> SqrtType t Source #

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

Instances

CanSqrt Double Source # 

Associated Types

type SqrtType Double :: * 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

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.

Associated Types

type ExpType t Source #

Methods

exp :: t -> ExpType t Source #

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

Instances

CanExp Double Source # 

Associated Types

type ExpType Double :: * Source #

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

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.

Associated Types

type LogType t Source #

Methods

log :: t -> LogType t Source #

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

Instances

CanLog Double Source # 

Associated Types

type LogType Double :: * Source #

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.

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.

Associated Types

type SinCosType t Source #

Methods

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 #

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.

Orphan instances