pointedlist-0.4.0.3: A zipper-like comonad which works as a list, tracking a position.

Data.List.PointedList.Circular

Synopsis

Documentation

next :: PointedList a -> PointedList aSource

Move the focus to the next element in the list. If the last element is currently focused, loop to the first element.

previous :: PointedList a -> PointedList aSource

Move the focus to the previous element in the list. If the first element is currently focused, loop to the last element.

deleteLeft :: PointedList a -> Maybe (PointedList a)Source

Possibly delete the element at the focus, then move the element on the left to the focus. If no element is on the left, focus on the element to the right. If the deletion will cause the list to be empty, return Nothing.

deleteRight :: PointedList a -> Maybe (PointedList a)Source

Possibly delete the element at the focus, then move the element on the right to the focus. If no element is on the right, focus on the element to the left. If the deletion will cause the list to be empty, return Nothing.