travitch / persistent-vector

Persistent vectors for Haskell based on array mapped tries
BSD 3-Clause "New" or "Revised" License
27 stars 4 forks source link

Should we add unsafeSnoc? #11

Open treeowl opened 3 years ago

treeowl commented 3 years ago

unordered-containers has a totally unsafe insertion function used to implement fromList and similar by mutating "immutable" maps with the help of unsafeThaw and unsafeFreeze. We could do something similar here, and use it to implement fromList, filter, and partition. This would avoid rebuilding a tree node just because one of its children has changed. Is it worth the trouble? I don't know yet.