Moduleoptics-core-0.4.1.1Haskell2010
Data.Sequence.Optics
This module defines optics for constructing and manipulating finite Seqs.
- 6 values
- Packageoptics-core-0.4.1.1
- Exports6
- LanguageHaskell2010
- LicenceBSD-3-Clause
- SourceOptics.hs
Traverse all the elements numbered from i to j of a Seq
Seq.fromList [1,2,3,4,5] & sliced 1 3 %~ (*10)fromList [1,20,30,4,5]
Seq.fromList [1,2,3,4,5] ^.. sliced 1 3[2,3]
Seq.fromList [1,2,3,4,5] & sliced 1 3 .~ 0fromList [1,0,0,4,5]
Traverse the first n elements of a Seq
Seq.fromList [1,2,3,4,5] ^.. slicedTo 2[1,2]
Seq.fromList [1,2,3,4,5] & slicedTo 2 %~ (*10)fromList [10,20,3,4,5]
Seq.fromList [1,2,4,5,6] & slicedTo 10 .~ 0fromList [0,0,0,0,0]
Traverse all but the first n elements of a Seq
Seq.fromList [1,2,3,4,5] ^.. slicedFrom 2[3,4,5]
Seq.fromList [1,2,3,4,5] & slicedFrom 2 %~ (*10)fromList [1,2,30,40,50]
Seq.fromList [1,2,3,4,5] & slicedFrom 10 .~ 0fromList [1,2,3,4,5]
Construct a Seq from a fold.
seqOf folded ["hello","world"]fromList ["hello","world"]
seqOf (folded % _2) [("hello",1),("world",2),("!!!",3)]fromList [1,2,3]