[Haskell-cafe] What is a safe Haskell data type to store and manipulate Money values?
dct25-561bs at mythic-beasts.com
Tue Apr 4 12:58:30 UTC 2017
On 4 Apr 2017 13:57, "David Turner" <dct25-561bs at mythic-beasts.com> wrote:
> It's the currency conversions that will provide the most interesting
> challenges in that list. If you were only working in a single currency then
> something based on `Integer` would, I think, be fine. Perhaps `Int` or
> `Int64` if you needed the extra speed.
> There are a number of different ways to implement multiple currencies
> depending on your desired semantics and applicable accounting rules and
> regulations. Peter Selinger has a good tutorial covering this at
> One thing to watch out for: do you want to be able to do arithmetic on
> amounts from different currencies? As in, do you want £5 + $5 to have a
> meaningful result? If you can avoid this, life will be much simpler.
> On 4 Apr 2017 12:22, "Saurabh Nanda" <saurabhnanda at gmail.com> wrote:
>> Hi Manuel,
>> Thank you for your reply. Some clarifications below...
>>> It depends on what sort of computation you'll be doing upon those
>>> monetary values and on the expectations of your users. It's typical
>>> that payment processing applications sacrifice precision and instead
>>> prefer to deal in exact quantities
>> Is there a document which explains common use-cases for monetary values
>> and best-practices for dealing with them? Any guidelines for which
>> **Haskell** data-types to use for what kind of monetary calculations?
>> Here is what we are doing in our app:
>> * Powering web-based e-commerce checkout flows
>> * Allowing store owners to input tax rates
>> * Allowing end-customers to see product prices in different currencies
>> (so, currency conversion)
>> * Various reports to see total sales, total receivables, and total
>> payables (basically a **very** small subset of small-business accounting)
>> * Exporting data to full-fledged accounting systems, like Quickbooks and
>> Based on this use-case, which Haskell data-type would you suggest?
>> -- Saurabh.
>> Haskell-Cafe mailing list
>> To (un)subscribe, modify options or view archives go to:
>> Only members subscribed via the mailman list are allowed to post.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe