Mutable arrays
Tomasz Zielonka
t.zielonka@students.mimuw.edu.pl
Thu, 8 May 2003 16:09:30 +0200
On Thu, May 08, 2003 at 02:34:14PM +0200, Koen Claessen wrote:
> Dear all,
>
> I have also a feature request for mutable arrays: Is it
> possible to prove a function like "realloc" which extends
> the array to a larger size, copying all existing
> information? Right now, I have to do this myself; I am using
> a type 'IORef (UArray ..)' which seems kind of silly and
> unnecessarily inefficient.
Unfortunately, it wouldn't be compatible with current MArray class. Its
declaration begins with:
class (HasBounds a, Monad m) => MArray a e m where
It requires type constructor 'a' to belong to HasBounds constructor
class. HasBounds' method 'bounds' knows nothing about Monad m, it is
a pure function:
bounds :: (Ix i) => a i e -> (i, i)
With realloc it would return m (i, i)
So, it is more a design issue than implementation issue.
> Regards,
> /Koen
Regards,
Tom
--
.signature: Too many levels of symbolic links