Safe Haskell | None |
---|---|
Language | Haskell2010 |
This module defines optics for constructing and manipulating finite Seq
s.
Documentation
sliced :: Int -> Int -> IxTraversal' Int (Seq a) a Source #
Traverse all the elements numbered from i
to j
of a Seq
>>>
fromList [1,2,3,4,5] & sliced 1 3 %~ (*10)
fromList [1,20,30,4,5]
>>>
fromList [1,2,3,4,5] ^.. sliced 1 3
[2,3]
>>>
fromList [1,2,3,4,5] & sliced 1 3 .~ 0
fromList [1,0,0,4,5]
slicedTo :: Int -> IxTraversal' Int (Seq a) a Source #
Traverse the first n
elements of a Seq
>>>
fromList [1,2,3,4,5] ^.. slicedTo 2
[1,2]
>>>
fromList [1,2,3,4,5] & slicedTo 2 %~ (*10)
fromList [10,20,3,4,5]
>>>
fromList [1,2,4,5,6] & slicedTo 10 .~ 0
fromList [0,0,0,0,0]
slicedFrom :: Int -> IxTraversal' Int (Seq a) a Source #
Traverse all but the first n
elements of a Seq
>>>
fromList [1,2,3,4,5] ^.. slicedFrom 2
[3,4,5]
>>>
fromList [1,2,3,4,5] & slicedFrom 2 %~ (*10)
fromList [1,2,30,40,50]
>>>
fromList [1,2,3,4,5] & slicedFrom 10 .~ 0
fromList [1,2,3,4,5]