Best immutable / shared memory data structure implementations in ReScript?

What are the best current options for ReScript immutable / shared memory data structures?

In particular looking for:

  • arrays
  • lists
  • maps.

Please feel free to list multiple options if there are trade-offs from a time/memory perspective!

1 Like

Belt provides immutable sets and maps: Belt | ReScript API

For arrays, the recommendation is to use them as-is and not introduce further complexity on top of JavaScript arrays. It’s also easy to write a simple immutable (copying) wrapper on top of mutable arrays if desired.

For lists, the recommendation is to prefer arrays over lists. But the built-in list<'a> type is already immutable and comes with the List module of support functions.