úÎ!è¹ßIœ      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›SafeX_G  safe-decimal%Monad for performing safe computation  safe-decimalConvert   computation to any  import Numeric.Decimal:set -XDataKinds5arithM (1.1 * 123 :: Arith (Decimal RoundDown 3 Int))135.3006arithM (1.1 - 123 :: Arith (Decimal RoundDown 3 Word))#*** Exception: arithmetic underflow-1.1 - 123 :: Arith (Decimal RoundDown 3 Word)ArithError arithmetic underflow safe-decimal A version of   restricted to œ safe-decimal A version of   restricted to  safe-decimal+Add two bounded numbers while checking for / safe-decimal0Subtract two bounded numbers while checking for / safe-decimal+Compute absolute value, while checking for  safe-decimal&Divide two numbers while checking for  and  safe-decimal0Find quotient of two numbers while checking for  and  safe-decimal=Find quotient an remainder of two numbers while checking for  and  safe-decimal(Multiply two numbers while checking for  safe-decimalConvert from an unbounded ž to a Ÿ  ), while checking for bounds and raising /  None.47=>?@AHMUVX_‡o(¡ safe-decimalRException thrown whenever operation cannot be performed withou loosing information safe-decimal2Rounding strategy to be used with decimal numbers. safe-decimal Reduce the scale of a number by k( decimal places using rounding strategy r safe-decimal&Decimal number with custom precision (p) and type level scaling (sW) parameter (i.e. number of digits after the decimal point). As well as the rounding (r) strategy to use.! safe-decimal1A way to type restrict a polymorphic computation.import Numeric.Decimal1arithRoundD @1 @RoundDown @2 @Word (123.05 + 1.1) Arith 124.1" safe-decimal1A way to type restrict a polymorphic computation.# provide an easy way to use TypeApplications to supply a type of Decimal:import Numeric.Decimal#:set -XDataKinds -XTypeApplications'arithMD @RoundDown @3 @Word (1.1 + 123)124.100'arithMD @RoundDown @3 @Word (1.1 - 123)#*** Exception: arithmetic underflow# safe-decimal1A way to type restrict a polymorphic computation.# provide an easy way to use TypeApplications to supply a type of Decimal:import Numeric.Decimal:set -XTypeApplications/arithM $ arithD @RoundDown @3 @Word (1.1 + 123)124.100/arithM $ arithD @RoundDown @3 @Word (1.1 - 123)#*** Exception: arithmetic underflow$ safe-decimal A version of # that converts to œimport Numeric.Decimal:set -XTypeApplications+arithMaybeD @RoundDown @3 @Word (1.1 + 123) Just 124.100+arithMaybeD @RoundDown @3 @Word (1.1 - 123)Nothing% safe-decimal A version of # that converts to & safe-decimal"Change the rounding strategy of a import Numeric.Decimal#:set -XDataKinds -XTypeApplications(d <- arithMD @RoundHalfUp @3 @Int 123.45+roundDecimal d :: Decimal RoundHalfUp 1 Int123.5:t castRounding @RoundDown d4castRounding @RoundDown d :: Decimal RoundDown 3 Int8roundDecimal (castRounding d) :: Decimal RoundDown 1 Int123.4' safe-decimalGet the scale of a . Argument is not evaluated.import Numeric.Decimal5d <- arithM (36 :: Arith (Decimal RoundHalfUp 5 Int))d36.00000 getScale d5( safe-decimalIncrease the precision of a , use  if inverse is desired.import Numeric.Decimal<d2 <- arithM (1.65 :: Arith (Decimal RoundHalfUp 2 Integer))d21.65,scaleUp d2 :: Decimal RoundHalfUp 50 Integer41.65000000000000000000000000000000000000000000000000) safe-decimalIncrease the precision of a  backed by a bounded type, use  if inverse is desired.import Numeric.Decimal:d2 <- arithM (1.65 :: Arith (Decimal RoundHalfUp 2 Int16))5scaleUpBounded d2 :: IO (Decimal RoundHalfUp 3 Int16)1.6505scaleUpBounded d2 :: IO (Decimal RoundHalfUp 4 Int16)1.65005scaleUpBounded d2 :: IO (Decimal RoundHalfUp 5 Int16)"*** Exception: arithmetic overflow* safe-decimalISplit the number at the decimal point, i.e. whole number and the fractionimport Numeric.Decimal=splitDecimal <$> (12.34 :: Arith (Decimal RoundHalfUp 2 Int)) Arith (12,34)+ safe-decimalGet the numerator. Same as ¢ . .import Numeric.Decimal#:set -XDataKinds -XTypeApplications9decimalNumerator <$> arithD @RoundHalfEven @3 @Int 123.45 Arith 123450, safe-decimal:Get the decimal denominator. Always will be a multiple of 10". Does not evaluate the argument.import Numeric.Decimal#:set -XDataKinds -XTypeApplications;decimalDenominator <$> arithD @RoundHalfEven @3 @Int 123.45 Arith 1000- safe-decimalWrap an   as a . No scaling will be done.import Numeric.Decimal-wrapDecimal 1234 :: Decimal RoundHalfUp 4 Int0.1234-wrapDecimal 1234 :: Decimal RoundHalfUp 2 Int12.34. safe-decimalVGet out the underlying representation for the decimal number. No scaling will be done.import Numeric.Decimal=unwrapDecimal (wrapDecimal 1234 :: Decimal RoundHalfUp 4 Int)1234/ safe-decimal Convert an ž' while performing the necessary scalingimport Numeric.Decimal8fromIntegerDecimal 1234 :: Decimal RoundHalfUp 4 Integer 1234.00000 safe-decimalRConvert a bounded integeral into a decimal, while performing the necessary scalingimport Numeric.DecimalAfromIntegralDecimalBounded 1234 :: IO (Decimal RoundHalfUp 4 Int) 1234.0000CfromIntegralDecimalBounded 1234 :: IO (Decimal RoundHalfUp 4 Int16)"*** Exception: arithmetic overflow1 safe-decimalnConvert a decimal backed by an integral to another decimal backed by a bounded integeral, while checking for /import Numeric.DecimalAfromIntegralDecimalBounded 1234 :: IO (Decimal RoundHalfUp 4 Int) 1234.0000CfromIntegralDecimalBounded 1234 :: IO (Decimal RoundHalfUp 4 Int16)"*** Exception: arithmetic overflow4 safe-decimal"Add two decimal numbers backed by ž.5 safe-decimal'Subtract two decimal numbers backed by ž.; safe-decimalAdd two decimal numbers.< safe-decimalSubtract two decimal numbers.= safe-decimalVMultiply two bounded decimal numbers, adjusting their scale at the type level as well.> safe-decimalVMultiply two bounded decimal numbers, adjusting their scale at the type level as well.? safe-decimal'Multiply two decimal numbers backed by ž@, while rounding the result according to the rounding strategy.@ safe-decimal[Multiply two decimal numbers, while rounding the result according to the rounding strategy.A safe-decimalFMultiply two decimal numbers that have the same scale, while throwing ¡a whenever multiplication cannot be done without rounding. Also checks for bounds and can throw /.B safe-decimalFMultiply two decimal numbers that have the same scale, while throwing ¡: whenever multiplication cannot be done without rounding.C safe-decimalDDivide two decimal numbers that have the same scale, while throwing ¡4 whenever division cannot be done without rounding.D safe-decimalDDivide two decimal numbers that have the same scale, while throwing ¡4 whenever division cannot be done without rounding.E safe-decimalConvert a decimal to a RationalF safe-decimal Convert from £ to a  backed by ž. ¡u will be thrown if conversion cannot be achieved without any loss of data. In case that rounding is acceptable use IG safe-decimal Convert a £ to a bounded -, but only if there is no precision loss or /Undeflow.J safe-decimal#Compute absolute value of a decimalK safe-decimal5Compute signum of a decimal, always one of 1, 0 or -1L safe-decimal5Compute signum of a decimal, always one of 1, 0 or -1M safe-decimalVCompute absolute value of a bounded decimal. Protects against overflows for negative ¤.abs (minBound :: Int8)-128import Numeric.DecimalHd <- arithM (fromRational (-1.28) :: Arith (Decimal RoundHalfUp 2 Int8))d-1.28HabsDecimalBounded d :: Either SomeException (Decimal RoundHalfUp 2 Int8)Left arithmetic overflowNote" - Watch out for order of negation+-1.28 :: Arith (Decimal RoundHalfUp 2 Int8)ArithError arithmetic overflow3negate (1.28 :: Arith (Decimal RoundHalfUp 2 Int8))ArithError arithmetic overflow:set -XNegativeLiterals+-1.28 :: Arith (Decimal RoundHalfUp 2 Int8) Arith -1.28<  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNNone ./>@AHUVXÜ}P safe-decimal Synonym for QQ safe-decimal 9https://en.wikipedia.org/wiki/Rounding#Round_towards_zeroRound towards zero strategy. Similar to Haskell's ¥6. Drop the fractional digits, regardless of the sign.:set -XDataKinds:set -XTypeApplications(arithRoundD @1 @RoundToZero @2 @Int 3.65 Arith 3.6(arithRoundD @1 @RoundToZero @2 @Int 3.75 Arith 3.7(arithRoundD @1 @RoundToZero @2 @Int 3.89 Arith 3.8+arithRoundD @1 @RoundToZero @2 @Int (-3.65) Arith -3.6R safe-decimalSynonym for round downS safe-decimal 4https://en.wikipedia.org/wiki/Rounding#Rounding_down Round down> rounding startegy. This the strategy that is implemented by ¦ . Round towards minus infinity::set -XDataKinds:set -XTypeApplications&arithRoundD @1 @RoundDown @2 @Int 3.65 Arith 3.6&arithRoundD @1 @RoundDown @2 @Int 3.75 Arith 3.7&arithRoundD @1 @RoundDown @2 @Int 3.89 Arith 3.8)arithRoundD @1 @RoundDown @2 @Int (-3.65) Arith -3.7T safe-decimal 9https://en.wikipedia.org/wiki/Rounding#Round_half_to_evenRound half even£ rounding strategy. If the fractional part of x is 0.5, then y is the even integer nearest to x. This is the default rounding strategy in Haskell implemented by §.:set -XDataKinds:set -XTypeApplications+arithRoundD @1 @RoundHalfEven @3 @Int 3.650 Arith 3.6+arithRoundD @1 @RoundHalfEven @3 @Int 3.740 Arith 3.7+arithRoundD @1 @RoundHalfEven @3 @Int 3.749 Arith 3.7+arithRoundD @1 @RoundHalfEven @3 @Int 3.750 Arith 3.8+arithRoundD @1 @RoundHalfEven @3 @Int 3.751 Arith 3.8+arithRoundD @1 @RoundHalfEven @3 @Int 3.760 Arith 3.8.arithRoundD @1 @RoundHalfEven @3 @Int (-3.650) Arith -3.6.arithRoundD @1 @RoundHalfEven @3 @Int (-3.740) Arith -3.7.arithRoundD @1 @RoundHalfEven @3 @Int (-3.749) Arith -3.7.arithRoundD @1 @RoundHalfEven @3 @Int (-3.750) Arith -3.8.arithRoundD @1 @RoundHalfEven @3 @Int (-3.751) Arith -3.8.arithRoundD @1 @RoundHalfEven @3 @Int (-3.760) Arith -3.8U safe-decimal 6https://en.wikipedia.org/wiki/Rounding#Round_half_downRound half down rounding strategy: :set -XDataKinds:set -XTypeApplications+arithRoundD @1 @RoundHalfDown @3 @Int 3.740 Arith 3.7+arithRoundD @1 @RoundHalfDown @3 @Int 3.749 Arith 3.7+arithRoundD @1 @RoundHalfDown @3 @Int 3.750 Arith 3.7+arithRoundD @1 @RoundHalfDown @3 @Int 3.751 Arith 3.8+arithRoundD @1 @RoundHalfDown @3 @Int 3.760 Arith 3.8.arithRoundD @1 @RoundHalfDown @3 @Int (-3.740) Arith -3.7.arithRoundD @1 @RoundHalfDown @3 @Int (-3.749) Arith -3.7.arithRoundD @1 @RoundHalfDown @3 @Int (-3.750) Arith -3.8.arithRoundD @1 @RoundHalfDown @3 @Int (-3.751) Arith -3.8.arithRoundD @1 @RoundHalfDown @3 @Int (-3.760) Arith -3.8V safe-decimal 4https://en.wikipedia.org/wiki/Rounding#Round_half_up Round half up rounding strategy::set -XDataKindsbroundDecimal <$> (3.740 :: Arith (Decimal RoundHalfUp 3 Int)) :: Arith (Decimal RoundHalfUp 1 Int) Arith 3.7*Or with a bit more concise approach using ! and TypeApplications: :set -XTypeApplications)arithRoundD @1 @RoundHalfUp @3 @Int 3.740 Arith 3.7)arithRoundD @1 @RoundHalfUp @3 @Int 3.749 Arith 3.7)arithRoundD @1 @RoundHalfUp @3 @Int 3.750 Arith 3.8)arithRoundD @1 @RoundHalfUp @3 @Int 3.751 Arith 3.8)arithRoundD @1 @RoundHalfUp @3 @Int 3.760 Arith 3.8,arithRoundD @1 @RoundHalfUp @3 @Int (-3.740) Arith -3.7,arithRoundD @1 @RoundHalfUp @3 @Int (-3.749) Arith -3.7,arithRoundD @1 @RoundHalfUp @3 @Int (-3.750) Arith -3.7,arithRoundD @1 @RoundHalfUp @3 @Int (-3.751) Arith -3.8,arithRoundD @1 @RoundHalfUp @3 @Int (-3.760) Arith -3.8\ safe-decimalO(1) - Conversion of a list.Note : It doesn't do any scaling, eg::set -XDataKindsimport Numeric.Decimal5decimalList [1,20,300] :: [Decimal RoundHalfUp 2 Int][0.01,0.20,3.00] If scaling is what you need use ¨ instead:;sequenceA [1, 20, 300] :: Arith [Decimal RoundHalfUp 2 Int]Arith [1.00,20.00,300.00]] safe-decimalSum a list of decimal numbers:set -XDataKindsZsequenceA [1.1, 20.02, 300.003] >>= sumDecimalBounded :: Arith (Decimal RoundHalfUp 3 Int) Arith 321.123^ safe-decimal>Multiply all decimal numbers in the list while doing rounding.:set -XDataKinds'product [1.1, 20.02, 300.003] :: Double6606.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_ safe-decimal Convert a  to ©` safe-decimalEConvert Scientific to Decimal without loss of precision. Will return ª  if ©( has too many decimal places, more than  scaling is capable to handle.a safe-decimalHConvert from Scientific to Decimal while checking for Overflow/Underflowb safe-decimal Convert a  to a «! with the exactly same precision.PtoFixedDecimal <$> (3.65 :: Arith (Decimal RoundDown 2 Int)) :: Arith (Fixed E2) Arith 3.65BtoFixedDecimal $ fromFixedDecimal (123.45 :: Fixed E2) :: Fixed E2123.45c safe-decimal Convert a « to a  with the exactly same precision%fromFixedDecimal (123.45 :: Fixed E2)123.45d safe-decimal Convert a «K to a decimal backed by a bounded integral with the exactly same precisionRfromFixedDecimalBounded (123.458 :: Fixed E3) :: Arith (Decimal RoundToZero 3 Int) Arith 123.458SfromFixedDecimalBounded (123.458 :: Fixed E3) :: Arith (Decimal RoundToZero 3 Int8)ArithError arithmetic overflowTfromFixedDecimalBounded (-123.458 :: Fixed E3) :: Arith (Decimal RoundToZero 3 Word)ArithError arithmetic underflow`   !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdR -.*+,'()&NJK45>B?C6/FHEML;<=A@D7018:9GI23 #"$%!VWUXTYSRZQP[\]^Obcd_`a¬      !"#$%&&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£¤¥¦§¨©ª«¬­«®«¯©°«±«²«³«´µ¶·¤¸¹º»¼+safe-decimal-0.2.0.0-JzJ72yLzLJNHQImpVFXEVSNumeric.Decimal!Numeric.Decimal.BoundedArithmeticNumeric.Decimal.InternalbaseGHC.Exception.TypeRatioZeroDenominatorDenormal DivideByZeroLossOfPrecision UnderflowOverflowArithException SomeException(exceptions-0.10.4-622ySnQapwMAU2KS1exqorControl.Monad.CatchthrowM MonadThrowArith ArithErrorarithM arithMaybe arithEither plusBounded minusBounded absBounded divBounded quotBoundedquotRemBounded timesBoundedfromIntegerBounded$fMonadThrowArith $fMonadArith$fApplicativeArith$fFunctorArith $fShowArithRound roundDecimalDecimal arithRoundDarithMDarithD arithMaybeD arithEitherD castRoundinggetScalescaleUpscaleUpBounded splitDecimaldecimalNumeratordecimalDenominator wrapDecimal unwrapDecimalfromIntegerDecimalfromIntegralDecimalBoundedintegralDecimalToDecimalBounded bindM2DecimalbindM2 plusDecimal minusDecimaldivideDecimalWithRounding divideDecimalBoundedWithRoundingquotRemDecimalBounded!fromIntegerDecimalBoundedIntegralfromIntegerDecimalBoundedplusDecimalBoundedminusDecimalBoundedtimesDecimalBounded timesDecimaltimesDecimalWithRoundingtimesDecimalBoundedWithRoundingtimesDecimalBoundedWithoutLosstimesDecimalWithoutLossdivideDecimalWithoutLossdivideDecimalBoundedWithoutLosstoRationalDecimalfromRationalDecimalWithoutLoss%fromRationalDecimalBoundedWithoutLossfromRationalDecimalWithRounding&fromRationalDecimalBoundedWithRounding absDecimal signumDecimalsignumDecimalBoundedabsDecimalBoundedparseDecimalBounded FixedScaleTruncate RoundToZeroFloor RoundDown RoundHalfEven RoundHalfDown RoundHalfUp roundHalfUp roundHalfDown roundHalfEven roundDown roundToZero decimalListsumDecimalBounded!productDecimalBoundedWithRoundingtoScientificDecimalfromScientificDecimalfromScientificDecimalBoundedtoFixedDecimalfromFixedDecimalfromFixedDecimalBounded$fRoundRoundHalfUpWord64$fRoundRoundHalfUpWord32$fRoundRoundHalfUpWord16$fRoundRoundHalfUpWord8$fRoundRoundHalfUpWord$fRoundRoundHalfUpInt64$fRoundRoundHalfUpInt32$fRoundRoundHalfUpInt16$fRoundRoundHalfUpInt8$fRoundRoundHalfUpInt$fRoundRoundHalfUpInteger$fRoundRoundHalfDownWord64$fRoundRoundHalfDownWord32$fRoundRoundHalfDownWord16$fRoundRoundHalfDownWord8$fRoundRoundHalfDownWord$fRoundRoundHalfDownInt64$fRoundRoundHalfDownInt32$fRoundRoundHalfDownInt16$fRoundRoundHalfDownInt8$fRoundRoundHalfDownInt$fRoundRoundHalfDownInteger$fRoundRoundHalfEvenWord64$fRoundRoundHalfEvenWord32$fRoundRoundHalfEvenWord16$fRoundRoundHalfEvenWord8$fRoundRoundHalfEvenWord$fRoundRoundHalfEvenInt64$fRoundRoundHalfEvenInt32$fRoundRoundHalfEvenInt16$fRoundRoundHalfEvenInt8$fRoundRoundHalfEvenInt$fRoundRoundHalfEvenInteger$fRoundRoundDownWord64$fRoundRoundDownWord32$fRoundRoundDownWord16$fRoundRoundDownWord8$fRoundRoundDownWord$fRoundRoundDownInt64$fRoundRoundDownInt32$fRoundRoundDownInt16$fRoundRoundDownInt8$fRoundRoundDownInt$fRoundRoundDownInteger$fRoundRoundToZeroWord64$fRoundRoundToZeroWord32$fRoundRoundToZeroWord16$fRoundRoundToZeroWord8$fRoundRoundToZeroWord$fRoundRoundToZeroInt64$fRoundRoundToZeroInt32$fRoundRoundToZeroInt16$fRoundRoundToZeroInt8$fRoundRoundToZeroInt$fRoundRoundToZeroInteger GHC.MaybeMaybe Data.EitherEither integer-gmpGHC.Integer.TypeIntegerGHC.EnumBoundedGHC.RealIntegral PrecisionLoss toIntegerRationalminBoundtruncatefloorround fromIntegral)scientific-0.3.6.2-6bc2BhY5av25ENBHp3W8voData.Scientific ScientificLeft text-1.2.3.1 Data.Text.Lazy.Builder.RealFloatFPFormat