[Haskell-cafe] Bug in writeArray?
duncan.coutts at worc.ox.ac.uk
Thu Sep 24 12:51:52 EDT 2009
On Thu, 2009-09-24 at 13:53 +0200, Grzegorz Chrupała wrote:
> 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
> imaginary problem.
It's now fixed:
More information about the Haskell-Cafe