Hoogle Search

Within LTS Haskell 24.25 (ghc-9.10.3)

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

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

    safe-decimal Numeric.Decimal

    Multiply all decimal numbers in the list while doing rounding.

    >>> :set -XDataKinds
    
    >>> product [1.1, 20.02, 300.003] :: Double
    6606.666066000001
    
    >>> xs <- arithM (mapM fromRational [1.1, 20.02, 300.003] :: Arith [Decimal RoundHalfUp 4 Int])
    
    >>> xs
    [1.1000,20.0200,300.0030]
    
    >>> productDecimalBoundedWithRounding xs
    6606.6661
    

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

    safe-decimal Numeric.Decimal

    No documentation available.

  3. scaleUpBounded :: forall (k :: Nat) r (n :: Nat) p m . (MonadThrow m, Integral p, Bounded p, KnownNat k) => Decimal r n p -> m (Decimal r (n + k) p)

    safe-decimal Numeric.Decimal

    Increase the precision of a Decimal backed by a bounded type, use roundDecimal if inverse is desired.

    >>> import Numeric.Decimal
    
    >>> d2 <- arithM (1.65 :: Arith (Decimal RoundHalfUp 2 Int16))
    
    >>> scaleUpBounded d2 :: IO (Decimal RoundHalfUp 3 Int16)
    1.650
    
    >>> scaleUpBounded d2 :: IO (Decimal RoundHalfUp 4 Int16)
    1.6500
    
    >>> scaleUpBounded d2 :: IO (Decimal RoundHalfUp 5 Int16)
    *** Exception: arithmetic overflow
    

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

    safe-decimal Numeric.Decimal

    Compute signum of a decimal, always one of 1, 0 or -1

  5. sumDecimalBounded :: forall m f p r (s :: Nat) . (MonadThrow m, Foldable f, Eq p, Ord p, Num p, Bounded p) => f (Decimal r s p) -> m (Decimal r s p)

    safe-decimal Numeric.Decimal

    Sum a list of decimal numbers

    >>> :set -XDataKinds
    
    >>> sequenceA [1.1, 20.02, 300.003] >>= sumDecimalBounded :: Arith (Decimal RoundHalfUp 3 Int)
    Arith 321.123
    

  6. timesDecimalBounded :: forall m p r (s1 :: Nat) (s2 :: Nat) . (MonadThrow m, Integral p, Bounded p) => Decimal r s1 p -> Decimal r s2 p -> m (Decimal r (s1 + s2) p)

    safe-decimal Numeric.Decimal

    Multiply two bounded decimal numbers, adjusting their scale at the type level as well.

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

    safe-decimal Numeric.Decimal

    Multiply two decimal numbers, while rounding the result according to the rounding strategy.

  8. timesDecimalBoundedWithoutLoss :: 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

    Multiply two decimal numbers that have the same scale, while throwing PrecisionLoss whenever multiplication cannot be done without rounding. Also checks for bounds and can throw Overflow/Underflow.

  9. absBounded :: (MonadThrow m, Num p, Ord p) => p -> m p

    safe-decimal Numeric.Decimal.BoundedArithmetic

    Compute absolute value, while checking for Overflow

  10. divBounded :: (MonadThrow m, Integral a, Bounded a) => a -> a -> m a

    safe-decimal Numeric.Decimal.BoundedArithmetic

    Divide two numbers while checking for Overflow and DivideByZero

Page 45 of many | Previous | Next