[Haskell-cafe] Error in array index.

Jason Dusek jason.dusek at gmail.com
Wed Jun 24 12:50:49 EDT 2009

2009/06/24 Ketil Malde <ketil at malde.org>:
> Bulat Ziganshin <bulat.ziganshin at gmail.com> writes:
>>>     array ((0,0),(65535,65535)) [((0,0),*** Exception: Error in array index
>> i think that it may be a bit too large for internal Int indicies:
> Aren't you asking for a 4G element array here, so with a 32bit
> wraparound the array will be some multiple of 4GB

  It's a bit array. It'd be 512MiB.

> So in effect, you have a zero-length underlying array, but the
> array implementation still keeps track of the real indices and
> tries to print some contents.  (Correct?)

  I don't quite understand your reasoning here.

> Since array dereferencing are now checked against the
> underlying array instead of the real indices, you get this
> kind of inconsistency.  It is greatly surprising to me that
> this has not been fixed.
> As long as 'unsafeAt' gives you the speed without the safety,
> I don't think the default dereferencing shouldn't sacrifice
> helpful error messages and predicability.

  This arrangement would make me LOL if it weren't my own

Jason Dusek

More information about the Haskell-Cafe mailing list