Alright, tried implementing and using this for my app, a few things to note:
1. After adding a few more helper functions and operators, this is actually quite nice to work with.
2. To use value classes I had to switch to a sealed interface. Nothing wrong with that, just pointing it out.
3. Some operations like getting the selection count, or checking whether it's empty, require knowing the full size of the original data (for the
Except
case). That's not a big deal, but it makes the APIs a little less elegant (see picture).