mixed-types-num-0.1.0.1: 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.Field

Contents

Description

 

Synopsis

Field

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 /.

Associated Types

type DivType t1 t2 Source #

Methods

divide :: t1 -> t2 -> DivType t1 t2 Source #

divide :: (DivType t1 t2 ~ t1, t1 ~ t2, Fractional t1) => t1 -> t1 -> t1 Source #

Instances

CanDiv Double Double Source # 

Associated Types

type DivType Double Double :: * Source #

CanDiv Double Int Source # 

Associated Types

type DivType Double Int :: * Source #

CanDiv Double Integer Source # 

Associated Types

type DivType Double Integer :: * Source #

CanDiv Double Rational Source # 

Associated Types

type DivType Double Rational :: * Source #

CanDiv Int Double Source # 

Associated Types

type DivType Int Double :: * Source #

CanDiv Int Int Source # 

Associated Types

type DivType Int Int :: * Source #

Methods

divide :: Int -> Int -> DivType Int Int Source #

CanDiv Int Integer Source # 

Associated Types

type DivType Int Integer :: * Source #

CanDiv Int Rational Source # 

Associated Types

type DivType Int Rational :: * Source #

CanDiv Integer Double Source # 

Associated Types

type DivType Integer Double :: * Source #

CanDiv Integer Int Source # 

Associated Types

type DivType Integer Int :: * Source #

CanDiv Integer Integer Source # 

Associated Types

type DivType Integer Integer :: * Source #

CanDiv Integer Rational Source # 
CanDiv Rational Double Source # 

Associated Types

type DivType Rational Double :: * Source #

CanDiv Rational Int Source # 

Associated Types

type DivType Rational Int :: * Source #

CanDiv Rational Integer Source # 
CanDiv Rational Rational Source # 
CanDiv a b => CanDiv [a] [b] Source # 

Associated Types

type DivType [a] [b] :: * Source #

Methods

divide :: [a] -> [b] -> DivType [a] [b] Source #

CanDiv a b => CanDiv (Maybe a) (Maybe b) Source # 

Associated Types

type DivType (Maybe a) (Maybe b) :: * Source #

Methods

divide :: Maybe a -> Maybe b -> DivType (Maybe a) (Maybe b) Source #

type CanDivBy t1 t2 = (CanDiv t1 t2, DivType t1 t2 ~ t1) Source #

(/) :: CanDiv t1 t2 => t1 -> t2 -> DivType t1 t2 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.

type CanDivX t1 t2 = (CanDiv t1 t2, Show t1, Arbitrary t1, Show t2, Arbitrary t2, Show (DivType t1 t2), HasEqCertainly t1 (DivType t1 t2)) Source #

Compound type constraint useful for test definition.