We had a short discussion on the IRC channel the other day about Arrays. I advocated that we do some refactoring work and didn't meet with overwhelming disagreement, so I wanted to propose that the Arrays interfaces be refactored in Haskell'.
As a Haskell new-ish-bie, the various Array interfaces seem a bit inconsistent and make learning/using arrays complicated. I *do* understand how to use arrays in Haskell, but I think that the interface could be cleaned up. Examples of current confusions: IArray and Array are dupes (obvious); listArray for IArray, but newListArray for MArrays; "!" for IArray, but readArray for MArrays. Proposal: I would propose the following for Haskell': "Array" is the interface for arrays; drop IArray; "MArray" is the interface for arrays in monads (IO, ST, etc); As much as possible, functions that operate on arrays will be the same for both Array and MArray (e.g. "!" for element access in both Array and MArray); In cases in which confusion would result from identical functions or in which it is beneficial to differentiate, functions will be minimally changed to identify the intended function type (e.g. listToArray for Array; listToMArray for MArray). Descriptive names ("toArray"; "toMArray") instead of termsOfArt ("freeze", "thaw"). --- Perhaps this e-mail could be read more generally as a request to consistencify/update the (Data) libraries in general (e.g. only use "unsafe*" if referential transparency is broken; group refs into Data.Ref.IO, Data.Ref.ST rather than Data.STRef, Data.IORef; create ListInterface Class to propogate consistently "toList" & "fromList" functions; append "_s" to functions that are stricified, "foldl_s" instead of "foldl'"; "//" performs very different functions in List and IArray). Is this possible for Haskell'? Or is this too much of a break? If it's possible, I'm happy to build a wiki page for discussion (I noticed that a short page has been started.) - Alson (A presumptuous new-ish-bie? Why yes, how did you guess?) _______________________________________________ Haskell-prime mailing list Haskell-prime@haskell.org http://haskell.org/mailman/listinfo/haskell-prime