In the source, we have elems = toList
.
Why do we need both functions?
Data.Set on Hackage
It's part of the pattern that most collections provide. In the case of set, there are no keys, so elems = toList
. However with things like a Map
, toList
returns an association list vs elems
which just returns the values.
So the seeming redundancy is to provide a consistent API with other collections like Map
, IntSet
Array
s and IntMap
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With