[Haskell-cafe] Re: Array interface refactoring

bulat.ziganshin at gmail.com bulat.ziganshin at gmail.com
Wed Feb 22 05:03:51 EST 2006


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 http://haskell.org/haskellwiki/Arrays ?

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:Bulat.Ziganshin at gmail.com



More information about the Haskell-Cafe mailing list