numeric-prelude-0.4.3.1: An experimental alternative hierarchy of numeric type classes

Safe HaskellNone
LanguageHaskell98

Algebra.ToInteger

Contents

Synopsis

Documentation

class (C a, C a) => C a where Source #

The two classes C and C exist to allow convenient conversions, primarily between the built-in types. They should satisfy

  fromInteger .  toInteger === id
   toRational .  toInteger === toRational

Conversions must be lossless, that is, they do not round in any way. For rounding see Algebra.RealRing.

I think that the RealIntegral superclass is too restrictive. Non-negative numbers are not a ring, but can be easily converted to Integers.

Minimal complete definition

toInteger

Methods

toInteger :: a -> Integer Source #

Instances
C Int Source # 
Instance details

Defined in Algebra.ToInteger

C Int8 Source # 
Instance details

Defined in Algebra.ToInteger

C Int16 Source # 
Instance details

Defined in Algebra.ToInteger

C Int32 Source # 
Instance details

Defined in Algebra.ToInteger

C Int64 Source # 
Instance details

Defined in Algebra.ToInteger

C Integer Source # 
Instance details

Defined in Algebra.ToInteger

C Word Source # 
Instance details

Defined in Algebra.ToInteger

C Word8 Source # 
Instance details

Defined in Algebra.ToInteger

C Word16 Source # 
Instance details

Defined in Algebra.ToInteger

C Word32 Source # 
Instance details

Defined in Algebra.ToInteger

C Word64 Source # 
Instance details

Defined in Algebra.ToInteger

C T Source # 
Instance details

Defined in Number.Peano

Methods

toInteger :: T -> Integer Source #

C a => C (T a) Source # 
Instance details

Defined in Number.NonNegative

Methods

toInteger :: T a -> Integer Source #

Integral a => C (T a) Source # 
Instance details

Defined in MathObj.Wrapper.Haskell98

Methods

toInteger :: T a -> Integer Source #

(C a, C a) => C (T a) Source # 
Instance details

Defined in Number.NonNegativeChunky

Methods

toInteger :: T a -> Integer Source #

C a => C (T a) Source # 
Instance details

Defined in MathObj.Wrapper.NumericPrelude

Methods

toInteger :: T a -> Integer Source #

fromIntegral :: (C a, C b) => a -> b Source #

ringPower :: (C a, C b) => b -> a -> a Source #

A prefix function of '(Algebra.Ring.^)' with a parameter order that fits the needs of partial application and function composition. It has generalised exponent.

See: Argument order of expNat on http://www.haskell.org/pipermail/haskell-cafe/2006-September/018022.html

fieldPower :: (C a, C b) => b -> a -> a Source #

A prefix function of '(Algebra.Field.^-)'. It has a generalised exponent.

Orphan instances

(C a, C a) => C (T a) Source # 
Instance details

Methods

toRational :: T a -> Rational Source #