| Portability | non-portable |
|---|---|
| Stability | experimental |
| Maintainer | Edward Kmett <ekmett@gmail.com> |
| Safe Haskell | None |
Data.Sequence.Lens
Description
- 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 %~ ffromList [f a,b,c,d]
>>>fromList [] ^? _headNothing
>>>fromList [a,b,c,d] ^? _headJust 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] ^? _tailJust (fromList [b,c])
>>>fromList [] ^? _tailNothing
_last :: SimpleIndexedTraversal Int (Seq a) aSource
Traverse the last element of a Seq
>>>fromList [a,b,c,d] & _last %~ ffromList [a,b,c,f d]
>>>fromList [a,b,c,d] ^? _lastJust d
>>>fromList [] ^? _lastNothing
_init :: SimpleTraversal (Seq a) (Seq a)Source
Traverse all but the last element of a Seq
>>>fromList [1,2,3] ^? _initJust (fromList [1,2])
>>>fromList [a,b,c,d] & _init.traverse %~ ffromList [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 %~ ffromList [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 %~ ffromList [f a,f b,c,d,e]
>>>fromList [a,b,c,d,e] & slicedTo 10 .~ xfromList [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 %~ ffromList [a,b,f c,f d,f e]
>>>fromList [a,b,c,d,e] & slicedFrom 10 .~ xfromList [a,b,c,d,e]