[Haskell-cafe] Implementation of scaled integers

Henning Thielemann lemming at henning-thielemann.de
Wed Feb 21 06:11:55 EST 2007


On Tue, 13 Feb 2007, Stefan Heinzmann wrote:

> Hi all,
>
> is there a library for Haskell that implements scaled integers, i.e.
> integers with a fixed scale factor so that the scale factor does not
> need to be stored, but is part of the type?

I have implemented them in a generic way for NumericPrelude type classes:
 http://darcs.haskell.org/numericprelude/src/Number/FixedPoint.hs

So far, I have only the interface
 http://darcs.haskell.org/numericprelude/src/Number/FixedPoint/Check.hs
  where the denominator is stored in the numbers and checked for each
operation. But it would be easy to add another interface which retrieves
the denominator from the type.


More information about the Haskell-Cafe mailing list