Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
AUTHOR
- Dr. Alistair Ward
DESCRIPTION
- Describes a simple numeric type, designed to contain an exponential number.
- https://en.wikipedia.org/wiki/Exponentiation.
- type Exponential base exponent = (base, exponent)
- evaluate :: (Num base, Integral exponent) => Exponential base exponent -> base
- invert :: Num exponent => Exponential base exponent -> Exponential base exponent
- getBase :: Exponential base exponent -> base
- getExponent :: Exponential base exponent -> exponent
- rightIdentity :: Num exponent => base -> Exponential base exponent
- (<^) :: Num exponent => Exponential base exponent -> exponent -> Exponential base exponent
- (=~) :: Eq base => Exponential base exponent -> Exponential base exponent -> Bool
Types
Type-synonyms
type Exponential base exponent = (base, exponent) Source #
Describes an exponential, in terms of its base and exponent.
Functions
evaluate :: (Num base, Integral exponent) => Exponential base exponent -> base Source #
Evaluate the specified Exponential
, returning the resulting number.
invert :: Num exponent => Exponential base exponent -> Exponential base exponent Source #
Invert the value, by negating the exponent.
Accessors
getBase :: Exponential base exponent -> base Source #
Accessor.
getExponent :: Exponential base exponent -> exponent Source #
Accessor.
Constructor
rightIdentity :: Num exponent => base -> Exponential base exponent Source #
- Construct an
Exponential
merely raised to the 1st power. - The value of the resulting exponential is the same as specified
base
; https://en.wikipedia.org/wiki/Identity_element.
Operators
:: Num exponent | |
=> Exponential base exponent | The operand. |
-> exponent | The power to which the exponential is to be raised. |
-> Exponential base exponent | The result. |
Raise the specified Exponential
to a power.
(=~) :: Eq base => Exponential base exponent -> Exponential base exponent -> Bool infix 4 Source #
True if the bases are equal.