RFC: general sequences

Henning Thielemann lemming at henning-thielemann.de
Tue May 24 09:01:46 EDT 2005


On Tue, 24 May 2005, Duncan Coutts wrote:

> On Tue, 2005-05-24 at 11:23 +0100, Malcolm Wallace wrote:
>> Ross Paterson <ross at soi.city.ac.uk> writes:
>>
>
>> Also, there was debate at the time of the Haskell'98 committee about
>> whether the list operations with an Int argument would be better
>> taking an Integer.  I believe the consensus was positive towards
>> unbounded Integer, but it was important for the standard to be
>> backwards compatible, so Int remained.  However, with a new library,
>> you have the opportunity to get it right from the start.
>
> There is also the argument that an Int is always big enough to be used
> as an index into a data structure that can fit in memory. This also
> applies to 64 bit machines because the Int just gets bigger. And so the
> argument goes, if Int is sufficient then there is the performance
> advantage of simple machine integers.

A list can be infinite, the garbage collector can throw away nodes with 
small indices. So it is possible to access nodes above INT_MAX. E.g. 
x!!(1e10) will generate 1e10 nodes but not all of them are hold in 
memory.


More information about the Libraries mailing list