[Haskell-cafe] Data.IArray rant

Roman Leshchinskiy rl at cse.unsw.edu.au
Sat Sep 3 10:46:34 CEST 2011

On 03/09/2011, at 03:04, Ivan Lazar Miljenovic wrote:

> On 3 September 2011 11:38, Evan Laforge <qdunkan at gmail.com> wrote:
>>  The result is that my first contact with haskell
>> arrays left me with the impression that they were complicated, hard to
>> use, and designed for someone with different priorities than me.  Of
>> course, Data.Vector didn't exist back then, but if someone were new to
>> haskell now I would recommend they skip Data.IArray and head straight
>> for vector.
> To an extent, I wonder how much of this has been that arrays were
> considered to be bad in Haskell, so no-one used them and no-one
> bothered to try and improve the API much (and instead went and created
> Vector, etc.).

It's rather that some considered the IArray API to be inadequate most of the time. Really, H98 arrays aren't very good at anything they do. For collective operations, you are supposed to convert the array to a list, work on the list and then convert it back to an array which just seems wrong. Multidimensional arrays can't be sliced and diced in the style of Repa or NumPy. In general, H98 arrays seem to have been designed with the goal of providing a container with O(1) indexing. They do that, I suppose, although they aren't very well integrated with the rest of the language and they have conceptual problems (such as requiring two bounds checks for one array access). But requirements have shifted quite a bit since then. Now, people want to write real array programs and they want those to be fast. Personally, I don't know how to improve the H98 array API to provide this. You basically need to create a completely new API based on different principles.


More information about the Haskell-Cafe mailing list