Claus Reinke wrote:
In general, I think Haskell has too many array libraries, with too many APIs. And that doesn't even take account the overuse of unsafe APIs, or the non-integrated type-level safety tricks - if array accesses were properly optimized, there should be a lot less need for the extreme all-or-nothing checks or home-grown alternative special-purpose APIs:
- type-level code for watermarking indices belonging to certain index sets is one step to eliminate index checks, but hasn't been integrated into any of the standard libs - one could also associate index subsets with operations that do not leave the index superset belonging to an array (eg, if min<i<max, then min<=i+-1<=max, still safe without checks) - GHC does seem to common up index checks only if they are identical, but if min<i<i+1<i+2<..<i+j<max, only the outer checks are really necessary (as long as we know about '+') - whole-array ops allow to avoid index checks without type-level tricks, leaving the indexing implicit; but the corresponding ops in Data.Array.MArray claim to construct new arrays, contrary to the intended inplace updating for which one uses MArrays? - etc. etc.
At least, uvector seems to take multi-element ops more seriously. But with so many people working on sequential and parallel Haskell array libraries, I was hoping for someone to take a big ax and clear out all that sick and half-dead wood, to give a small number of healthy arrays libs room to grow. Would be a lot easier for us poor naive Haskell array users who otherwise tend to get lost in that forrest!-)
+3 The current array situation is unecessarily messy - and I prefer mathematical elegance to ad-hoc mess. (And you think I use Haskell, why exactly?) Of course, it's all very well complaining about it... somebody still has to *do* all this wonderful stuff. :-/