Copyright | (c) 2017 2018 N Steenbergen |
---|---|
License | GPL-3 |
Maintainer | ns@slak.ws |
Stability | experimental |
Safe Haskell | Safe |
Language | Haskell2010 |
Re-export PointedList
with convenience functions.
- asList :: PointedList a -> [a]
- toList :: Foldable t => forall a. t a -> [a]
- current :: PointedList a -> a
- insertAll :: Traversable t => t a -> Maybe (PointedList a) -> Maybe (PointedList a)
- focus :: PointedList a -> [PointedList a]
- modify :: PointedList a -> (a -> Maybe a) -> Maybe (PointedList a)
- update :: PointedList a -> Maybe a -> Maybe (PointedList a)
Documentation
asList :: PointedList a -> [a] Source #
Turn a PointedList
into a non-pointed list, assuming no particular
ordering.
current :: PointedList a -> a Source #
Get the current focus of a PointedList
.
insertAll :: Traversable t => t a -> Maybe (PointedList a) -> Maybe (PointedList a) Source #
Add a number of entries to a possibly empty PointedList
.
focus :: PointedList a -> [PointedList a] Source #
Create a list of variations of the provided PointedList
, one for each
element to take focus.
This function is a bit sloppy. It assumes no particular order. Note that using
toList
instead can cause longer (or shorter?) running times.
modify :: PointedList a -> (a -> Maybe a) -> Maybe (PointedList a) Source #
Update the focused element of a PointedList
using a function that
returns Just
the new value, or Nothing
for deletion.
update :: PointedList a -> Maybe a -> Maybe (PointedList a) Source #
Update the focused element of a PointedList
with the value of the
Just
, or delete the element if that value is Nothing
.