fixed-decimal-0.0.2: Fixed precision decimals for Haskell
Safe HaskellSafe-Inferred
LanguageHaskell2010

Data.Fixed.Decimal

Description

Decimal types of fixed precision and scale which can use any Integral type to store mantissa

Synopsis

Documentation

newtype Decimal m (s :: Nat) #

Decimal type of fixed precision and scale which uses:

  • m: Integral type to store mantissa
  • s: Type-level number Nat to define scale (fractional part size)

Constructors

Decimal 

Fields

Instances

Instances details
(Integral m, KnownNat s) => FixedDecimal (Decimal m s) # 
Instance details

Defined in Data.Fixed.Decimal

Associated Types

type Precision (Decimal m s) 
Instance details

Defined in Data.Fixed.Decimal

type Precision (Decimal m s) = m
type Scale (Decimal m s) 
Instance details

Defined in Data.Fixed.Decimal

type Scale (Decimal m s) = s

Methods

scale :: Decimal m s -> Int #

decimal :: Integral m0 => m0 -> Int -> Decimal m s #

Bounded m => Bounded (Decimal m s) # 
Instance details

Defined in Data.Fixed.Decimal

Methods

minBound :: Decimal m s #

maxBound :: Decimal m s #

(Enum m, Integral m, KnownNat s, KnownNat (10 ^ s)) => Enum (Decimal m s) # 
Instance details

Defined in Data.Fixed.Decimal

Methods

succ :: Decimal m s -> Decimal m s #

pred :: Decimal m s -> Decimal m s #

toEnum :: Int -> Decimal m s #

fromEnum :: Decimal m s -> Int #

enumFrom :: Decimal m s -> [Decimal m s] #

enumFromThen :: Decimal m s -> Decimal m s -> [Decimal m s] #

enumFromTo :: Decimal m s -> Decimal m s -> [Decimal m s] #

enumFromThenTo :: Decimal m s -> Decimal m s -> Decimal m s -> [Decimal m s] #

(Integral m, KnownNat s, KnownNat (10 ^ s)) => Num (Decimal m s) # 
Instance details

Defined in Data.Fixed.Decimal

Methods

(+) :: Decimal m s -> Decimal m s -> Decimal m s #

(-) :: Decimal m s -> Decimal m s -> Decimal m s #

(*) :: Decimal m s -> Decimal m s -> Decimal m s #

negate :: Decimal m s -> Decimal m s #

abs :: Decimal m s -> Decimal m s #

signum :: Decimal m s -> Decimal m s #

fromInteger :: Integer -> Decimal m s #

(Integral m, Read m, KnownNat s) => Read (Decimal m s) # 
Instance details

Defined in Data.Fixed.Decimal

(Integral m, KnownNat s, KnownNat (10 ^ s)) => Fractional (Decimal m s) # 
Instance details

Defined in Data.Fixed.Decimal

Methods

(/) :: Decimal m s -> Decimal m s -> Decimal m s #

recip :: Decimal m s -> Decimal m s #

fromRational :: Rational -> Decimal m s #

(Integral m, KnownNat s, KnownNat (10 ^ s)) => Real (Decimal m s) # 
Instance details

Defined in Data.Fixed.Decimal

Methods

toRational :: Decimal m s -> Rational #

(Show m, Integral m, KnownNat s) => Show (Decimal m s) # 
Instance details

Defined in Data.Fixed.Decimal

Methods

showsPrec :: Int -> Decimal m s -> ShowS #

show :: Decimal m s -> String #

showList :: [Decimal m s] -> ShowS #

Eq m => Eq (Decimal m s) # 
Instance details

Defined in Data.Fixed.Decimal

Methods

(==) :: Decimal m s -> Decimal m s -> Bool #

(/=) :: Decimal m s -> Decimal m s -> Bool #

Ord m => Ord (Decimal m s) # 
Instance details

Defined in Data.Fixed.Decimal

Methods

compare :: Decimal m s -> Decimal m s -> Ordering #

(<) :: Decimal m s -> Decimal m s -> Bool #

(<=) :: Decimal m s -> Decimal m s -> Bool #

(>) :: Decimal m s -> Decimal m s -> Bool #

(>=) :: Decimal m s -> Decimal m s -> Bool #

max :: Decimal m s -> Decimal m s -> Decimal m s #

min :: Decimal m s -> Decimal m s -> Decimal m s #

type Precision (Decimal m s) # 
Instance details

Defined in Data.Fixed.Decimal

type Precision (Decimal m s) = m
type Scale (Decimal m s) # 
Instance details

Defined in Data.Fixed.Decimal

type Scale (Decimal m s) = s