[Haskell-cafe] What is a safe Haskell data type to store and manipulate Money values?

David Turner dct25-561bs at mythic-beasts.com
Tue Apr 4 14:44:14 UTC 2017


`Data.Decimal.Decimal` is quite close to Java's `BigDecimal` in intent but
not quite the same: Java's `BigDecimal` has a 32-bit signed exponent
whereas Haskell's `Decimal`'s exponent is 8-bit and unsigned. The
difference shouldn't matter for the purposes of tracking money since
accountancy rules are generally designed to prefer (carefully specified)
rounding over keeping track of numbers with hundreds of decimal places.

On 4 April 2017 at 15:13, ALeX Kazik <alex at kazik.de> wrote:

> > Leaving aside the legal aspects of this, what would be Haskell's
> equivalent
> > of the BigDecimal format in Java (or Ruby)? Decimal (as used by hledger)?
>
> Rational?
>
> ALeX.
> _______________________________________________
> Haskell-Cafe mailing list
> To (un)subscribe, modify options or view archives go to:
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
> Only members subscribed via the mailman list are allowed to post.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20170404/7ef7704f/attachment.html>


More information about the Haskell-Cafe mailing list