Array interface refactoring

John Meacham john at
Wed Feb 22 20:23:32 EST 2006

On Wed, Feb 22, 2006 at 06:47:19PM +0000, Ben Rudiak-Gould wrote:
> While we're on the topic, I have a couple of problems with the current 
> array system that cut deeper than the naming:
>     * The function for getting the bounds of an MArray is pure, so the
>       interface can't accommodate resizable arrays.

Indeed. this has bothered me a whole lot too. I keep on trying to
implement an expanding circular buffer and then being sad when it can't
be done.

We could fix it fairly easily, we just need to get rid of HasBounds as a
superclass of MArray and add a new method 'getBounds' that returns the
bounds in the monad and then modify the default methods to use getBounds
rather than bounds.  since they are all already in the monad this will
work just fine.

it would be almost perfectly backwards compatable, the only change would
be some code might need to list HasBounds in their type signatures
seperatly. If we can get this in before the next release of ghc that
would be really great.


John Meacham - ⑆⑆john⑈

More information about the Haskell-prime mailing list