I’m looking for libraries for storing and working with currency.
I’ve found a few so far but would be interested in seeing if there are any that I’ve overlooked.
I’ll be doing calculations on these values (variance, square root, standard deviation) so it would be ideal if they had instances for working with standard math operators (+, -, ^, sqrt, log, etc).
Numeric.Decimal
It has support for IEEE 754-2008 but is marked as experimental.
Data.Decimal
Works with arithmetic operators but missing instance for Fractional so I can’t use it with sqrt and friends without implementing the functionality myself it seems. Despite this, it looks promising.
Data.Ratio
http://hackage.haskell.org/package/base-4.12.0.0/docs/Data-Ratio.html
Has a tendency to explode in space and performance can be poor.
Data.Scientific
http://hackage.haskell.org/package/scientific-0.3.3.5/docs/Data-Scientific.html
Looks good, but from the documentation: Although Scientific
is an instance of Fractional
, the methods are only partially defined! Specifically recip
and /
will diverge (i.e. loop and consume all space) when their outputs have an infinite decimal expansion