Reputation: 4344
I'm reading on HAMT's, and looked at a reference implementation in unordered-containers, but noticed that they have their own implementation of arrays. Why is this? Is it for speed? Or is it for some custom API that they require?
Upvotes: 1
Views: 207
Reputation: 8153
After looking at the code I can see a few optimizations. It does not have support for the "Ix" index translation that most Haskell Arrays have. It has specialized primitives such as insert'
that insert into the middle and dynamically resize the array, something STArray does not support, as well as delete'
which does shrinks the array.
So the answer is both speed and custom API.
Upvotes: 8