[Haskell-cafe] Reading integers

Neil Mitchell ndmitchell at gmail.com
Wed Sep 6 17:45:03 EDT 2006

Hi Bertram,

> Currently I have a single module that provides reading operations
> for Integers and Ints. I'm not quite sure what to do with it.

Get it into base! Where it is, or what its called is less relevant -
perhaps entirely decoupled from the Read class, and I wouldn't have
thought reading octal integers etc was useful - just simple bog
standard integers. I'd really like just readInt/readInteger in
Numeric, or Prelude, or possibly even a new Read style module.

> I'm pondering breaking compatibility with Haskell 98 to some extent
> and implementing  read instances for Int and Integer that don't diverge
> on weird inputs, but handle all valid numbers that Haskell 98 supports.

Thats nice, but a stand alone readInt that is not tied to reads, and
the whole "leftover parse" thing can be dropped - probably for better
performance. Of course, making an existing read faster is also good.

> It also includes a simple benchmark for comparing reads, Numeric.readDec
> and my readInteger functions. Results for my computer are included as
> well.

Any chance of a very quick summary of the results? i.e. on average x%
faster, but y% faster for integers over size z? Saves everyone darcs's
in. As far as I am concerned, the code is a black box, but the
statistics are something everyone will want.



More information about the Haskell-Cafe mailing list