pure-Haskell Integer implementation
I was working on a re-implementation of the Integer type in pure Haskell earlier this summer, represented by [Int], thinking it might be useful as a less-broken alternative to GMP than using plain Int for Integer. The code turned out around 500-1000 lines. It got pretty much working (in yhc, ghc, and hugs; according to QuickCheck comparing the results with native Integer anyway), though the code's still somewhat messy ...and large Integer division seems to be sometimes slower than expected (maybe a strictness issue, haven't looked into it) ...although, all functions are fast for small values that fit in one Int. Is anyone interested in more details or work on this? (P.S. I wonder if I should ask any other mailing list than yhc's?) Isaac
Hello, On Thursday 26 July 2007 17:42, Isaac Dupree wrote:
I was working on a re-implementation of the Integer type in pure Haskell earlier this summer, represented by [Int], thinking it might be useful as a less-broken alternative to GMP than using plain Int for Integer. The code turned out around 500-1000 lines. It got pretty much working (in yhc, ghc, and hugs; according to QuickCheck comparing the results with native Integer anyway), though the code's still somewhat messy ...and large Integer division seems to be sometimes slower than expected (maybe a strictness issue, haven't looked into it) ...although, all functions are fast for small values that fit in one Int. Is anyone interested in more details or work on this?
More details, certainly. Work on it: Probably not, but for comparison with other approaches, this would be very useful.
(P.S. I wonder if I should ask any other mailing list than yhc's?)
Isaac _______________________________________________ Yhc mailing list Yhc@haskell.org http://www.haskell.org/mailman/listinfo/yhc
Thanks and best regards Thorkil
Hi Isaac,
(maybe a strictness issue, haven't looked into it) ...although, all functions are fast for small values that fit in one Int. Is anyone interested in more details or work on this?
I am interested in the code! Yhc has the option to not build Integer's into the compiler, which saves space, and eases libgmp porting issues. This seems like the perfect middle ground. Perhaps you could release it as a library to Hackage? Perhaps call it BigInt rather than Integer, then Yhc in "no libgmp" mode can silently rename Integer -> BigInt without it having to go into base.
(P.S. I wonder if I should ask any other mailing list than yhc's?)
Perhaps libraries@ ? I can envisage #ifdef NATIVE_INTEGER then primitives, else use your Integer library. Thanks Neil
participants (3)
-
Isaac Dupree -
Neil Mitchell -
Thorkil Naur