Hoogle Search

Within LTS Haskell 24.31 (ghc-9.10.3)

Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.

  1. divideDecimalBoundedWithRounding :: forall m (s :: Nat) r p . (MonadThrow m, KnownNat s, Round r Integer, Bounded p, Integral p) => Decimal r s p -> Decimal r s p -> m (Decimal r s p)

    safe-decimal Numeric.Decimal

    No documentation available.

  2. divideDecimalBoundedWithoutLoss :: forall r (s :: Nat) p m . (Integral p, Bounded p, KnownNat s, MonadThrow m) => Decimal r s p -> Decimal r s p -> m (Decimal r s p)

    safe-decimal Numeric.Decimal

    Divide two decimal numbers that have the same scale, while throwing PrecisionLoss whenever division cannot be done without rounding.

  3. fromFixedDecimalBounded :: forall (s :: Nat) e m p r . (s ~ FixedScale e, MonadThrow m, Integral p, Bounded p) => Fixed e -> m (Decimal r s p)

    safe-decimal Numeric.Decimal

    Convert a Fixed to a decimal backed by a bounded integral with the exactly same precision

    >>> fromFixedDecimalBounded (123.458 :: Fixed E3) :: Arith (Decimal RoundToZero 3 Int)
    Arith 123.458
    
    >>> fromFixedDecimalBounded (123.458 :: Fixed E3) :: Arith (Decimal RoundToZero 3 Int8)
    ArithError arithmetic overflow
    
    >>> fromFixedDecimalBounded (-123.458 :: Fixed E3) :: Arith (Decimal RoundToZero 3 Word)
    ArithError arithmetic underflow
    

  4. fromIntegerDecimalBounded :: forall m r (s :: Nat) p . (MonadThrow m, Integral p, Bounded p) => Decimal r s Integer -> m (Decimal r s p)

    safe-decimal Numeric.Decimal

    No documentation available.

  5. fromIntegerDecimalBoundedIntegral :: forall m r (s :: Nat) p . (MonadThrow m, Integral p, Bounded p, KnownNat s) => Integer -> m (Decimal r s p)

    safe-decimal Numeric.Decimal

    Convert an Integer to a Decimal backed by a bounded integral while doing proper scaling and checking the bounds.

  6. fromIntegralDecimalBounded :: forall p (s :: Nat) m r . (Integral p, Bounded p, KnownNat s, MonadThrow m) => p -> m (Decimal r s p)

    safe-decimal Numeric.Decimal

    Convert a bounded integeral into a decimal, while performing the necessary scaling

    >>> import Numeric.Decimal
    
    >>> fromIntegralDecimalBounded 1234 :: IO (Decimal RoundHalfUp 4 Int)
    1234.0000
    
    >>> fromIntegralDecimalBounded 1234 :: IO (Decimal RoundHalfUp 4 Int16)
    *** Exception: arithmetic overflow
    

  7. fromRationalDecimalBoundedWithRounding :: forall m r (s :: Nat) p . (MonadThrow m, KnownNat s, Round r Integer, Bounded p, Integral p) => Rational -> m (Decimal r s p)

    safe-decimal Numeric.Decimal

    No documentation available.

  8. fromRationalDecimalBoundedWithoutLoss :: forall m (s :: Nat) p r . (MonadThrow m, KnownNat s, Integral p, Bounded p) => Rational -> m (Decimal r s p)

    safe-decimal Numeric.Decimal

    Convert a Rational to a bounded Decimal, but only if there is no precision loss or Overflow/Undeflow.

  9. fromScientificDecimalBounded :: forall m r (s :: Nat) p . (MonadThrow m, Integral p, Bounded p, KnownNat s) => Scientific -> m (Decimal r s p)

    safe-decimal Numeric.Decimal

    Convert from Scientific to bounded Decimal while checking for Overflow/Underflow

  10. integralDecimalToDecimalBounded :: forall p' p (s :: Nat) m r . (Integral p', Integral p, Bounded p, KnownNat s, MonadThrow m) => Decimal r s p' -> m (Decimal r s p)

    safe-decimal Numeric.Decimal

    Convert a decimal backed by an integral to another decimal backed by a bounded integeral, while checking for Overflow/Underflow

    >>> import Numeric.Decimal
    
    >>> fromIntegralDecimalBounded 1234 :: IO (Decimal RoundHalfUp 4 Int)
    1234.0000
    
    >>> fromIntegralDecimalBounded 1234 :: IO (Decimal RoundHalfUp 4 Int16)
    *** Exception: arithmetic overflow
    

Page 44 of many | Previous | Next