fromIntegral package:safe-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