I’ve just recently released https://github.com/paluh/purescript-pointed-list . A tiny library which is a port of haskell pointedlist
.
It can be useful for example when you want to implement undo
/ redo
functionality…
Thanks a lot to @ewaldgrusk who has commited multiple improvements!
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.
Hi @thomashoneyman!
I think that the pointed list structure can be used for selection too. Current fold
implementation allows you to quickly iterate and probably render your items. On the other hand there is small difference between type suggested by you and structure from library - this Maybe
around selected value. I’m not sure if there are real gains but probably we want to leave this “non empty” property of List.Pointed
structure… Sorry for this handwvy answer…