[Haskell-cafe] Bug in writeArray?
pitekus at gmail.com
Thu Sep 24 07:53:51 EDT 2009
2009/9/23 Bulat Ziganshin <bulat.ziganshin at gmail.com>:
> Hello Grzegorz,
> Wednesday, September 23, 2009, 7:19:59 PM, you wrote:
>> This seems like a bug in the implementation of writeArray: when passed
>> let (l,u) = ((0,10),(20,20))
> writeArray computes raw index (from 0 to total number of array
> elements) and check that this index is correct. with multi-dimensional
> arrays this approach may lead to wrong results, as you mentioned. it's
> known problem that isn't fixed for a long time probably due to
> efficiency cautions.
Hmm, I understand that efficiency is an issue, but in that case
shouldn't unsafe writing be provided by and unsafeWriteArray function,
while writeArray does proper range checking?
Or at least this problem with writeArray should be clearly indicated
in the documentation. I for one spent several hours debugging before
finding out about this lack of proper range checks so it's not an
More information about the Haskell-Cafe