/usr/share/doc/libghc-pointedlist-doc/html/pointedlist.txt is in libghc-pointedlist-doc 0.4.0.4-3build2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 | -- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | A zipper-like comonad which works as a list, tracking a position.
--
-- A PointedList tracks the position in a non-empty list which works
-- similarly to a zipper. A current item is always required, and
-- therefore the list may never be empty. A circular PointedList wraps
-- around to the other end when progressing past the actual edge.
@package pointedlist
@version 0.4.0.4
-- | An implementation of a zipper-like non-empty list structure that
-- tracks an index position in the list (the <a>focus</a>).
module Data.List.PointedList
-- | The implementation of the pointed list structure which tracks the
-- current position in the list structure.
data PointedList a
PointedList :: [a] -> a -> [a] -> PointedList a
reversedPrefix :: PointedList a -> [a]
_focus :: PointedList a -> a
suffix :: PointedList a -> [a]
lSuffix :: Arrow arr => Lens arr (PointedList a) [a]
lReversedPrefix :: Arrow arr => Lens arr (PointedList a) [a]
focus :: Arrow arr => Lens arr (PointedList a) a
-- | Create a <a>PointedList</a> with a single element.
singleton :: a -> PointedList a
-- | Possibly create a <tt><a>Just</a> <a>PointedList</a></tt> if the
-- provided list has at least one element; otherwise, return Nothing.
--
-- The provided list's head will be the focus of the list, and the rest
-- of list will follow on the right side.
fromList :: [a] -> Maybe (PointedList a)
-- | Possibly create a <tt><a>Just</a> <a>PointedList</a></tt> if the
-- provided list has at least one element; otherwise, return Nothing.
--
-- The provided list's last element will be the focus of the list,
-- following the rest of the list in order, to the left.
fromListEnd :: [a] -> Maybe (PointedList a)
-- | Replace the focus of the list, retaining the prefix and suffix.
replace :: a -> PointedList a -> PointedList a
-- | Possibly move the focus to the next element in the list.
next :: PointedList a -> Maybe (PointedList a)
-- | Attempt to move the focus to the next element, or <a>error</a> if
-- there are no more elements.
tryNext :: PointedList a -> PointedList a
-- | Possibly move the focus to the previous element in the list.
previous :: PointedList a -> Maybe (PointedList a)
-- | Attempt to move the focus to the previous element, or <a>error</a> if
-- there are no more elements.
tryPrevious :: PointedList a -> PointedList a
-- | An alias for <a>insertRight</a>.
insert :: a -> PointedList a -> PointedList a
-- | Insert an element to the left of the focus, then move the focus to the
-- new element.
insertLeft :: a -> PointedList a -> PointedList a
-- | Insert an element to the right of the focus, then move the focus to
-- the new element.
insertRight :: a -> PointedList a -> PointedList a
-- | An alias of <a>deleteRight</a>.
delete :: PointedList a -> Maybe (PointedList a)
-- | 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
-- <a>Nothing</a>.
deleteLeft :: PointedList a -> Maybe (PointedList a)
-- | 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 <a>Nothing</a>.
deleteRight :: PointedList a -> Maybe (PointedList a)
-- | Delete all elements in the list except the focus.
deleteOthers :: PointedList a -> PointedList a
-- | The length of the list.
length :: PointedList a -> Int
-- | Whether the focus is the first element.
atStart :: PointedList a -> Bool
-- | Whether the focus is the last element.
atEnd :: PointedList a -> Bool
-- | Create a <a>PointedList</a> of variations of the provided
-- <a>PointedList</a>, in which each element is focused, with the
-- provided <a>PointedList</a> as the focus of the sets.
positions :: PointedList a -> PointedList (PointedList a)
-- | Map over the <a>PointedList</a>s created via <a>positions</a>, such
-- that <tt>f</tt> is called with each element of the list focused in the
-- provided <a>PointedList</a>. An example makes this easier to
-- understand:
--
-- <pre>
-- contextMap atStart (fromJust $ fromList [1..5])
-- </pre>
contextMap :: (PointedList a -> b) -> PointedList a -> PointedList b
-- | Create a <tt><a>PointedList</a> a</tt> of <tt>(a, <a>Bool</a>)</tt>,
-- in which the boolean values specify whether the current element has
-- the focus. That is, all of the booleans will be <a>False</a>, except
-- the focused element.
withFocus :: PointedList a -> PointedList (a, Bool)
-- | Move the focus to the specified index. The first element is at index
-- 0.
moveTo :: Int -> PointedList a -> Maybe (PointedList a)
-- | Move the focus by <tt>n</tt>, relative to the current index. Negative
-- values move the focus backwards, positive values more forwards through
-- the list.
moveN :: Int -> PointedList a -> Maybe (PointedList a)
-- | Move the focus to the specified element, if it is present.
--
-- Patch with much faster algorithm provided by Runar Bjarnason for
-- version 0.3.2. Improved again by Runar Bjarnason for version 0.3.3 to
-- support infinite lists on both sides of the focus.
find :: Eq a => a -> PointedList a -> Maybe (PointedList a)
-- | The index of the focus, leftmost is 0.
index :: PointedList a -> Int
instance Traversable PointedList
instance Foldable PointedList
instance Functor PointedList
instance Show a => Show (PointedList a)
instance Binary a_1627402417 => Binary (PointedList a_1627402417)
instance Eq a => Eq (PointedList a)
module Data.List.PointedList.Circular
-- | Move the focus to the next element in the list. If the last element is
-- currently focused, loop to the first element.
next :: PointedList a -> PointedList a
-- | Move the focus to the previous element in the list. If the first
-- element is currently focused, loop to the last element.
previous :: PointedList a -> PointedList a
-- | An alias of <a>deleteRight</a>.
delete :: PointedList a -> Maybe (PointedList a)
-- | 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
-- <tt>Nothing</tt>.
deleteLeft :: PointedList a -> Maybe (PointedList a)
-- | 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 <tt>Nothing</tt>.
deleteRight :: PointedList a -> Maybe (PointedList a)
-- | Move
moveN :: Int -> PointedList a -> PointedList a
|