Change the API of MArray to allow resizable arrays
authorSimon Marlow <simonmar@microsoft.com>
Wed, 9 Aug 2006 10:05:48 +0000 (10:05 +0000)
committerSimon Marlow <simonmar@microsoft.com>
Wed, 9 Aug 2006 10:05:48 +0000 (10:05 +0000)
commit50b46f721cd1d8966f9dd7cf20c44427b4ebc44f
treec6a76042c344936cb0bebef5545ff53679a35a3d
parent832ed3c1559a65a65b688c1e1adf0874ab8907de
Change the API of MArray to allow resizable arrays
See #704

The MArray class doesn't currently allow a mutable array to change its
size, because of the pure function

  bounds :: (HasBounds a, Ix i) => a i e -> (i,i)

This patch removes the HasBounds class, and adds

  getBounds :: (MArray a e m, Ix i) => a i e -> m (i,i)

to the MArray class, and

  bounds :: (IArray a e, Ix i) => a i e -> (i,i)

to the IArray class.

The reason that bounds had to be incorporated into the IArray class is
because I couldn't make DiffArray work without doing this.  DiffArray
acts as a layer converting an MArray into an IArray, and there was no
way (that I could find) to define an instance of HasBounds for
DiffArray.
Data/Array/Base.hs
Data/Array/Diff.hs
Data/Array/IArray.hs
Data/Array/IO/Internals.hs
Data/Array/MArray.hs
Data/Array/Storable.hs