Re: Array interface refactoring

Previous Topic Next Topic
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Re: Array interface refactoring

Bulat Ziganshin-2
Hello Alson,

Tuesday, February 21, 2006, 11:33:49 PM, you wrote:

AK> As a Haskell new-ish-bie, the various Array interfaces
AK> seem a bit inconsistent and make learning/using arrays
AK> complicated.  I *do* understand how to use arrays in
AK> Haskell, but I think that the interface could be
AK> cleaned up.

sorry, but i think that you don't understand the whole situation. btw,
are you read ?

AK> Examples of current confusions:
AK>  IArray and Array are dupes (obvious);

Array is a type constructor, while IArray is a class

AK>  listArray for IArray, but newListArray for MArrays;
AK>  "!" for IArray, but readArray for MArrays.

they have different types

(!) :: IArray -> Ix -> Element
readArray :: MArray -> Ix -> IO Element

can you unify these two operations - one monadic and one pure to
common type signature?

AK> Proposal: I would propose the following for Haskell':
AK>  "Array"  is the interface for arrays; drop IArray;
AK>  "MArray" is the interface for arrays in monads (IO,
AK> ST, etc);

and these two interfaces should support operations with the same names
but different types? :)

i partially agree with your other suggestions

Best regards,
 Bulat                            mailto:[hidden email]

Haskell-Cafe mailing list
[hidden email]