| Portability | portable |
|---|---|
| Stability | provisional |
| Maintainer | Edward Kmett <ekmett@gmail.com> |
| Safe Haskell | Safe-Inferred |
Data.List.Lens
Contents
Description
Traversals for manipulating parts of a list.
- _head :: Simple Lens [a] a
- _tail :: Simple Lens [a] [a]
- _last :: Simple Lens [a] a
- _init :: Simple Lens [a] [a]
- traverseHead :: SimpleIndexedTraversal Int [a] a
- traverseTail :: SimpleIndexedTraversal Int [a] a
- traverseInit :: SimpleIndexedTraversal Int [a] a
- traverseLast :: SimpleIndexedTraversal Int [a] a
Partial Lenses
Traversals
traverseHead :: SimpleIndexedTraversal Int [a] aSource
A traversal for reading and writing to the head of a list
The position of the head in the original list (0) is available as the index.
>>>traverseHead +~ 1 $ [1,2,3][2,2,3]
traverseHead::Applicativef => (a -> f a) -> [a] -> f [a]
traverseTail :: SimpleIndexedTraversal Int [a] aSource
A traversal for editing the tail of a list
The position of each element in the original list is available as the index.
>>>traverseTail +~ 1 $ [1,2,3][1,3,4]
traverseTail::Applicativef => (a -> f a) -> [a] -> f [a]
traverseInit :: SimpleIndexedTraversal Int [a] aSource
A traversal of all but the last element of a list
The position of each element is available as the index.
>>>traverseInit +~ 1 $ [1,2,3][2,3,3]
traverseInit::Applicativef => (a -> f a) -> [a] -> f [a]
traverseLast :: SimpleIndexedTraversal Int [a] aSource
A traversal the last element in a list
The position of the last element in the original list is available as the index.
>>>traverseLast +~ 1 $ [1,2,3][1,2,4]
traverseLast::Applicativef => (a -> f a) -> [a] -> f [a]