Portability | non-portable |
---|---|
Stability | experimental |
Maintainer | Edward Kmett <ekmett@gmail.com> |
Safe Haskell | None |
- ordinal :: Int -> SimpleIndexedLens Int (Seq a) a
- viewL :: Iso (Seq a) (Seq b) (ViewL a) (ViewL b)
- viewR :: Iso (Seq a) (Seq b) (ViewR a) (ViewR b)
- _head :: SimpleIndexedTraversal Int (Seq a) a
- _tail :: SimpleTraversal (Seq a) (Seq a)
- _last :: SimpleIndexedTraversal Int (Seq a) a
- _init :: SimpleTraversal (Seq a) (Seq a)
- sliced :: Int -> Int -> SimpleIndexedTraversal Int (Seq a) a
- slicedTo :: Int -> SimpleIndexedTraversal Int (Seq a) a
- slicedFrom :: Int -> SimpleIndexedTraversal Int (Seq a) a
Documentation
_head :: SimpleIndexedTraversal Int (Seq a) aSource
Traverse the head of a Seq
>>>
fromList [a,b,c,d] & _head %~ f
fromList [f a,b,c,d]
>>>
fromList [] ^? _head
Nothing
>>>
fromList [a,b,c,d] ^? _head
Just a
_tail :: SimpleTraversal (Seq a) (Seq a)Source
Traverse the tail of a Seq
>>>
fromList [a,b] & _tail .~ fromList [c,d,e]
fromList [a,c,d,e]
>>>
fromList [a,b,c] ^? _tail
Just (fromList [b,c])
>>>
fromList [] ^? _tail
Nothing
_last :: SimpleIndexedTraversal Int (Seq a) aSource
Traverse the last element of a Seq
>>>
fromList [a,b,c,d] & _last %~ f
fromList [a,b,c,f d]
>>>
fromList [a,b,c,d] ^? _last
Just d
>>>
fromList [] ^? _last
Nothing
_init :: SimpleTraversal (Seq a) (Seq a)Source
Traverse all but the last element of a Seq
>>>
fromList [1,2,3] ^? _init
Just (fromList [1,2])
>>>
fromList [a,b,c,d] & _init.traverse %~ f
fromList [f a,f b,f c,d]
>>>
fromList [] & _init .~ fromList [a,b,c]
fromList []
sliced :: Int -> Int -> SimpleIndexedTraversal Int (Seq a) aSource
Traverse all the elements numbered from i
to j
of a Seq
>>>
fromList [a,b,c,d,e] & sliced 1 3 %~ f
fromList [a,f b,f c,d,e]
slicedTo :: Int -> SimpleIndexedTraversal Int (Seq a) aSource
Traverse the first n
elements of a Seq
>>>
fromList [a,b,c,d,e] ^.. slicedTo 2
[a,b]
>>>
fromList [a,b,c,d,e] & slicedTo 2 %~ f
fromList [f a,f b,c,d,e]
>>>
fromList [a,b,c,d,e] & slicedTo 10 .~ x
fromList [x,x,x,x,x]
slicedFrom :: Int -> SimpleIndexedTraversal Int (Seq a) aSource
Traverse all but the first n
elements of a Seq
>>>
fromList [a,b,c,d,e] ^.. slicedFrom 2
[c,d,e]
>>>
fromList [a,b,c,d,e] & slicedFrom 2 %~ f
fromList [a,b,f c,f d,f e]
>>>
fromList [a,b,c,d,e] & slicedFrom 10 .~ x
fromList [a,b,c,d,e]