I've written a total of five posts (or six, including this one) about why I would like to replace the
Array. If you'd missed one, here they all are:
- Introduction - the grand plan
- Part Deux - Improving the
- Part π - stoppable fold operations
- Part SC4K - API changes
- Part Boron - literal representation
These posts lists a ton of work. First we need to alter the
Array implementation to improve performance in even more cases. Then we need to make it more extensible by introducing stoppable fold operations. Then we need to add functions that currently exists for
List, but not for
Array. Finally, we can make the Elm compiler output a literal representation of
But why do all this work? Because I honestly believe Elm becomes easier to learn if the default collection type not only works similarly to the default collection type in other languages, but also provides decent performance for most cases you wish to use it with. I also believe Elm will become faster in the general case, if
Array is used in all the places
List is used today.
I might not be right. But I do think it will be an undertaking worth taking. Or... Uh... You know what I mean.
The next and first step of this journey will be to upgrade the
Array implementation from being a HAMT to an RRB-Tree. This process will probably take a while, but expect a new blog post with benchmark results when it happens.
Thank you for reading!