Unordered collections 1.6.0


I’ve been asked to announce this here, so here we go: I recently released version 1.6.0 of purescript-unordered-collections. It contains hash-based versions of the data structures in purescript-ordered-collections, namely a hash map and a hash set.

The goals of this library are API compatibility with the ord-based collections where reasonable and to be fast. These are mostly met, but feel free to file issues if there’s a bug, I missed a function, or things are slower than what you would expect.

I’m currently working on getting the/a Hashable typeclass into the prelude, which should make it easier to use -unordered-collections. In the meantime, you’ll have depend on this library to write Hashable instances for your own types, or submit PR’s for instances to be included where that makes more sense.

Finally, a word on FFI use because someone is probably going to ask about it: The hash map is mostly written in JavaScript. I’m not happy about it, but I think core data structures should be as fast as possible. I would rather have higher maintenance burden for a core library than everything that uses it be slow. Unfortunately psc does not generate optimal code, so often it is quite a bit faster to write things in JavaScript. Or maybe it’s just easier to write fast code. (There’s a heterogeneous array of keys, values, and map nodes internally, which is a bit awkward to type.) Anyway, it is a well-understood data structure and now that it’s done, I don’t expect much to change anymore. (Famous last words right there. Please report bugs if you find them!)