[Haskell-cafe] Request for Comments - hscurrency 0.0.1

Antoine Latter aslatter at gmail.com
Sat Aug 15 13:23:55 EDT 2009

On Sat, Aug 15, 2009 at 7:15 AM, Max Cantor<mxcantor at gmail.com> wrote:
> Hi all,
> I'm putting together some simple tools to do safe calculations on different
> currencies.  For instance, making sure that you dont add something like 5
> USD + 10 JPY without doing a proper conversion.
> I've put up some code on google code which probably explains what I'm trying
> to do more succinctly than this email.  I'm curious what poeple think about
> the library, its the first haskell code I've written for the purpose of
> sharing and I intend to add it to hackage once I finalize the interface a
> bit more.
> The code is at: http://bit.ly/1Cjjlj
> I'm very open to suggestions on improving the interface.  RIght now its very
> simple and straightforward but potentially limited.
> I originally wrote it so that the Prc type would be an instance of several
> numerical classes but eventually stripped that out as it required returning
> undefined in several cases (such as calling toIntegral on a Prc which was a
> composite of several currencies).  I felt it was better to avoid having
> partial functions..

The names aren't immediately clear to me, but maybe they make sense in
the discipline of currency trading.

Are these sorts of calculations commonly done with double precision
floats? Doing any sort of currency math with binary floating point
numbers feels odd to me, but again, I may not be the target for this
sort of library.


More information about the Haskell-Cafe mailing list