mixed-types-num-0.4.0.2: 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.Round

Contents

Description

 
Synopsis

Rounded division + modulus

class CanDivIMod t1 t2 where Source #

Minimal complete definition

divIMod

Associated Types

type DivIType t1 t2 Source #

type ModType t1 t2 Source #

Methods

divIMod :: t1 -> t2 -> (DivIType t1 t2, ModType t1 t2) Source #

mod :: t1 -> t2 -> ModType t1 t2 Source #

divI :: t1 -> t2 -> DivIType t1 t2 Source #

Instances
CanDivIMod Double Double Source # 
Instance details

Defined in Numeric.MixedTypes.Round

Associated Types

type DivIType Double Double :: Type Source #

type ModType Double Double :: Type Source #

CanDivIMod Double Integer Source # 
Instance details

Defined in Numeric.MixedTypes.Round

Associated Types

type DivIType Double Integer :: Type Source #

type ModType Double Integer :: Type Source #

CanDivIMod Integer Integer Source # 
Instance details

Defined in Numeric.MixedTypes.Round

CanDivIMod Rational Integer Source # 
Instance details

Defined in Numeric.MixedTypes.Round

CanDivIMod Rational Rational Source # 
Instance details

Defined in Numeric.MixedTypes.Round

modNoCN :: (CanDivIMod t1 t2, ModType t1 t2 ~ EnsureCN t1, CanEnsureCN t1) => t1 -> t2 -> t1 Source #

divINoCN :: (CanDivIMod t1 t2, DivIType t1 t2 ~ CN Integer) => t1 -> t2 -> Integer Source #

divIModNoCN :: (CanDivIMod t1 t2, ModType t1 t2 ~ EnsureCN t1, CanEnsureCN t1, DivIType t1 t2 ~ CN Integer) => t1 -> t2 -> (Integer, t1) Source #

Rounding

class CanRound t where Source #

A replacement for Prelude's RealFrac operations, such as round in which the result type is fixed to Integer.

If RealFrac t and CanTestPosNeg t, then one can use the default implementation to mirror Prelude's round, etc.

In other cases, it is sufficient to define properFraction.

Minimal complete definition

Nothing

class HasIntegerBounds t where Source #

Minimal complete definition

Nothing

Tests

specCanDivIMod :: (CanDivIModX t, HasIntegers t) => T t -> Spec Source #

HSpec properties that each implementation of CanRound should satisfy.

specCanRound :: (CanRoundX t, HasIntegers t) => T t -> Spec Source #

HSpec properties that each implementation of CanRound should satisfy.

specHasIntegerBounds :: HasIntegerBoundsX t => T t -> Spec Source #

HSpec properties that each implementation of CanRound should satisfy.