[Haskell-cafe] money type ?

Bayley, Alistair Alistair_Bayley at invescoperpetual.co.uk
Thu Jul 12 04:40:04 EDT 2007


> From: haskell-cafe-bounces at haskell.org 
> [mailto:haskell-cafe-bounces at haskell.org] On Behalf Of Simon Michael
> 
> Is there a type or library out there that's good for 
> representing money and 
> other quantities while avoiding rounding errors  ?

I think Data.Fixed would be a good choice:
 
http://www.haskell.org/ghc/docs/latest/html/libraries/base/Data-Fixed.ht
ml

I don't know /exactly/ how you'd go about adding a Money data type; I
guess you'd have something like:

> data E2 = E2
> instance HasResolution E2 where resolution _ = 100
> type Money = Fixed E2

Alistair
*****************************************************************
Confidentiality Note: The information contained in this message,
and any attachments, may contain confidential and/or privileged
material. It is intended solely for the person(s) or entity to
which it is addressed. Any review, retransmission, dissemination,
or taking of any action in reliance upon this information by
persons or entities other than the intended recipient(s) is
prohibited. If you received this in error, please contact the
sender and delete the material from any computer.
*****************************************************************


More information about the Haskell-Cafe mailing list