I need to represent a set and I’m starting to work with Data.Set. I see that there’s nothing to do really – singleton, union, intersection, etc. are all just there. I like it. I can express “what”, not “how”. But my inner C programmer is uncomfortable. There are many ways to implement a set (binary tree, hash, boolean array, etc.) Can I really trust Data.Set to choose the best one? Can I guide it in some way, or do I just surrender to its (I admit, probably superior) judgement?
I need to represent a set and I’m starting to work with Data.Set. I
Share
Data.Sethas no inner intelligence (just see the source!). It is just a balanced tree or ordered elements. You can look around on hackage for many other set and set-like structures with different performance characteristics. For example, see unordered-containers (HashSet), HashTables and bloomfilter.