ANN: HIntegerByInt

John Meacham john at
Mon Aug 13 18:21:54 EDT 2007

On Sat, Aug 11, 2007 at 12:09:44PM -0300, Isaac Dupree wrote:
> BTW: I estimate that it took me about two solid weeks of time, more than 
> I had originally intended to spend :)
> I think using CPP will prove important, but makes it harder to test in 
> Hugs... should I use Cabal if I want to use Hugs with haskell+cpp code?

I think if you were willing to use what is provided by the FFI
extension, you could make some signifigant improvements without
resorting to CPP. mainly, you could use unsigned arithmetic and have
access to bit operations.

I was thinking a representation like

data Integer = Integer !Bool Rest
data Rest = Digit !Word Rest | End

where the Bool indicates the sign, and the rest are the base-wordsize
digits. It would also be possible to just use a sign bit in the number
of course. that unboxed strict Word should make a big difference.

(it is not clear to me whether being strict in the 'Rest' field will
help or hinder, testing with both would be interesting)


John Meacham - ⑆⑆john⑈

More information about the Libraries mailing list