Hey, awesome @paluh! This reminds me a bit of a data type that some folks were asking about in #purescript-beginners:
SelectableArray a = { before :: Array a, selected :: Maybe a, after :: Array a }
I wonder if it could be used for this sort of selection management as well as history operations. Of course, the main difference is that in a selection list, the “previous” bit wouldn’t be reversed.