Re: Bignums in Haskell

2005-06-22 Thread Marco Morazan
I believe that native support for bignums is a rather interesting and good idea for Haskell and for other functional languages. Developing native support provides the opportunity to implement many optimizations for a specific language (without, of course, sacrificing the usefulness of the design fo

RE: Bignums in Haskell

2005-06-22 Thread Simon Marlow
On 21 June 2005 22:52, John Meacham wrote: > 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

RE: Bignums in Haskell

2005-06-22 Thread Simon Peyton-Jones
nd even in the imperative case there is no reason in principle why a runST-encapsulated imperative algorithm should be slower than C --- although at the moment GHC does not do a consistently good job of compiling imperative code. So I rather agree with John: implementing bignums in Haskell, and tryi

Re: Bignums in Haskell

2005-06-21 Thread Marco Morazan
This is a rather interesting question. Most "efficient" implementations use array-based representations for bignums that are mutable. The use of mutable arrays appears to be justified, because of divide-and-conquer multiplication and division algorithms (e.g. Karatsuba) that perform these operation

Re: Bignums in Haskell

2005-06-21 Thread John Meacham
On Wed, Jun 22, 2005 at 12:47:02AM +0200, [EMAIL PROTECTED] wrote: > John Meacham writes: > > >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 t

Re: Bignums in Haskell

2005-06-21 Thread karczma
John Meacham writes: 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 c

Re: Bignums in Haskell

2005-06-21 Thread John Meacham
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

RE: Bignums in Haskell

2005-06-21 Thread Simon Peyton-Jones
| >> 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 whe

RE: Bignums in Haskell

2005-06-21 Thread Simon Marlow
On 21 June 2005 12:47, Ketil Malde wrote: > Marco Morazan <[EMAIL PROTECTED]> writes: > >> Do any of you have insight into why GHC uses GMP as opposed to >> another library for arbitrary precision numbers? > > Did you have any particular other library in mind? I'm not too > well-versed in this,

Re: Bignums in Haskell

2005-06-21 Thread Jerzy Karczmarczuk
Serge D. Mechveliani wrote: Efficient arithmetic algorithms for large numbers is a matter of mathematics. Such algorithms, and libraries, are developed by the best experts in computational mathematics. Maybe, GMP is such. There isn't too much mathematics in... everything is known for years,

Re: Bignums in Haskell

2005-06-21 Thread Serge D. Mechveliani
On Tue, Jun 21, 2005 at 07:37:08AM -0400, Marco Morazan wrote: > Hello all, > > Do any of you have insight into why GHC uses GMP as opposed to another > library for arbitrary precision numbers? Also, why would bignums not > be directly implemented for the GHC or other implementations of > Haskell?

Re: Bignums in Haskell

2005-06-21 Thread Ketil Malde
Marco Morazan <[EMAIL PROTECTED]> writes: > Do any of you have insight into why GHC uses GMP as opposed to another > library for arbitrary precision numbers? Did you have any particular other library in mind? I'm not too well-versed in this, but I think GMP is fairly efficient, well tested and

Bignums in Haskell

2005-06-21 Thread Marco Morazan
Hello all, Do any of you have insight into why GHC uses GMP as opposed to another library for arbitrary precision numbers? Also, why would bignums not be directly implemented for the GHC or other implementations of Haskell? Best wishes, Marco ___ Glasg