patch applied (packages/base): Change the API of MArray to allow resizable arrays

Simon Marlow simonmar at microsoft.com
Wed Aug 9 06:05:41 EDT 2006


Wed Aug  9 03:05:48 PDT 2006  Simon Marlow <simonmar at microsoft.com>
  * 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.

    M ./Data/Array/Base.hs -43 +123
    M ./Data/Array/Diff.hs -13 +27
    M ./Data/Array/IArray.hs -1
    M ./Data/Array/IO/Internals.hs -15 +40
    M ./Data/Array/MArray.hs -5 +1
    M ./Data/Array/Storable.hs -3 +1


More information about the Cvs-libraries mailing list