Arrays in Haskell, was: Re: Functional programming in Python

Wojciech Moczydlowski, Jr khaliff@astercity.net
Fri, 11 May 2001 18:30:27 +0200 (CEST)


On Tue, 8 May 2001, Erik Meijer wrote:

> Interestingly enough, I have the same feeling with Python!

Speaking of problems with Haskell, almost every time I write a larger
program, I'm frustrated with lack of efficient arrays/hashtables in the
standard. I know about ghc (I|U|M)Arrays for arrays and probably there
are hashtables implemented in Edison library, but the program's
portability would be lost and nhc/hugs would protest. I would be very 
happy if Haskell developers could settle on a simple, not sophisticated 
standard arrays.
I personally would like an interface like:

data Array type_of_objects_stored = ...     -- abstract
data MArray a b = ... -- abstract
instance Monad (MArray a)

put :: Int -> a -> Array a -> MArray ()      
get :: Array a -> MArray a

runMArray :: Int -> MArray a -> a   -- int parameter is a size of used
array.

Even if they were put in IO, I still would not protest. Anything is better
than nothing.

Wojciech Moczydlowski, Jr