Data.Fixed and type encoded integers (Was: [Haskell-cafe]
Implementation of scaled integers)
lemming at henning-thielemann.de
Wed Feb 21 06:16:43 EST 2007
On Tue, 13 Feb 2007, Twan van Laarhoven wrote:
> 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?
> Data.Fixed  does exactly that, only it is based on Integer. Using
> fixed point with finite sized integers is more tricky, because you have
> to be careful not to get overflows in intermediate results.
Is it a good idea to put the HasResolution type class and the types E6 and
E12 in Data.Fixed? They are useful for every application where integers
shall be encoded in types.
More information about the Haskell-Cafe