Bignums in Haskell

John Meacham john at
Tue Jun 21 17:51:36 EDT 2005

On Tue, Jun 21, 2005 at 03:48:44PM +0100, Simon Peyton-Jones wrote:
> | >> Do any of you have insight into why GHC uses GMP as opposed to
> | >> another library for arbitrary precision numbers?
> | >
> ...
> | 
> | Right - that's three reasons to use it.  Some reasons *not* to use it
> | are: it has an awkward license, it's big, it needs updating, and we
> run
> | into problems when the Haskell program wants to use GMP itself via the
> | FFI (it's possible by essentially renaming everything in our local
> copy
> | of GMP so it doesn't conflict, but we haven't done that).
> In fact, we have long wanted to replace GMP with another library for
> exactly these reasons.  It's a nice, well-specified, self-contained
> project, which is just waiting for someone to step up and do it.  Of
> course, we'd only want to replace GMP if the alternative was also fast
> and reliable.
> If anyone is interested in tackling this, let us know!

I wonder if it would be feasable to implement arbitrary precision
integers in pure haskell. unboxed values would probably want to be used
in some places for speed and it would be very motivating to improve
ghc's optimizer. There should be no reason manually unboxed haskell code
should compile slower than C.  


John Meacham - ⑆⑆john⑈ 

More information about the Glasgow-haskell-users mailing list