lens-3.8.7.3: Lenses, Folds and Traversals

Portability | Rank2Types
Stability | provisional
Maintainer | Edward Kmett <ekmett@gmail.com>
Safe Haskell | None

Data.List.Split.Lens

Contents

- Splitting Folds
- Lenses for `Splitter` Internals

Description

Lenses for working with Data.List.Split

Synopsis

- splitting :: Splitter a -> Getting (Endo [a]) s s a a -> Fold s [a]
- splittingOn :: Eq a => [a] -> Getting (Endo [a]) s s a a -> Fold s [a]
- splittingOneOf :: Eq a => [a] -> Getting (Endo [a]) s s a a -> Fold s [a]
- splittingWhen :: Eq a => (a -> Bool) -> Getting (Endo [a]) s s a a -> Fold s [a]
- endingBy :: Eq a => [a] -> Getting (Endo [a]) s s a a -> Fold s [a]
- endingByOneOf :: Eq a => [a] -> Getting (Endo [a]) s s a a -> Fold s [a]
- wordingBy :: Eq a => (a -> Bool) -> Getting (Endo [a]) s s a a -> Fold s [a]
- liningBy :: Eq a => (a -> Bool) -> Getting (Endo [a]) s s a a -> Fold s [a]
- chunking :: Int -> Getting (Endo [a]) s s a a -> Fold s [a]
- splittingPlaces :: Integral n => [n] -> Getting (Endo [a]) s s a a -> Fold s [a]
- splittingPlacesBlanks :: Integral n => [n] -> Getting (Endo [a]) s s a a -> Fold s [a]
- delimiters :: Lens (Splitter a) (Splitter b) [a -> Bool] [b -> Bool]
- delimiting :: Lens' (Splitter a) DelimPolicy
- condensing :: Lens' (Splitter a) Bool
- keepInitialBlanks :: Lens' (Splitter a) Bool
- keepFinalBlanks :: Lens' (Splitter a) Bool

# Splitting Folds

splitting :: Splitter a -> Getting (Endo [a]) s s a a -> Fold s [a]

Obtain a `Fold` by splitting another `Fold`, `Lens`, `Getter` or `Traversal` according to the given splitting strategy.

     splitting :: Splitter a -> Fold i s a -> Fold [i] s [a]

splittingOn :: Eq a => [a] -> Getting (Endo [a]) s s a a -> Fold s [a]

Obtain a `Fold` by splitting another `Fold`, `Lens`, `Getter` or `Traversal` on the given delimiter.

Equivalent to ``splitting` `.` `dropDelims` `.` `onSublist``.

     splittingOn :: Eq a => [a] -> Fold s a -> Fold s [a]

splittingOneOf :: Eq a => [a] -> Getting (Endo [a]) s s a a -> Fold s [a]

Obtain a `Fold` by splitting another `Fold`, `Lens`, `Getter` or `Traversal` on any of the given elements.

Equivalent to ``splitting` `.` `dropDelims` `.` `oneOf``.

     splittingOn :: Eq a => [a] -> Fold s a -> Fold s [a]

splittingWhen :: Eq a => (a -> Bool) -> Getting (Endo [a]) s s a a -> Fold s [a]

Obtain a `Fold` by splitting another `Fold`, `Lens`, `Getter` or `Traversal` on elements satisfying the given predicate.

Equivalent to ``splitting` `.` `dropDelims` `.` `whenElt``.

     splittingOn :: (a -> Bool) -> Fold s a -> Fold s [a]

endingBy :: Eq a => [a] -> Getting (Endo [a]) s s a a -> Fold s [a]

Obtain a `Fold` by splitting another `Fold`, `Lens`, `Getter` or `Traversal` into chunks terminated by the given delimiter.

Equivalent to ``splitting` `.` `dropDelims` `.` `onSublist``.

     endingBy :: Eq a => [a] -> Fold s a -> Fold s [a]

endingByOneOf :: Eq a => [a] -> Getting (Endo [a]) s s a a -> Fold s [a]

Obtain a `Fold` by splitting another `Fold`, `Lens`, `Getter` or `Traversal` into chunks terminated by any of the given elements.

Equivalent to ``splitting` `.` `dropFinalBlank` `.` `dropDelims` `.` `oneOf``.

     endingByOneOf :: Eq a => [a] -> Fold s a -> Fold s [a]

wordingBy :: Eq a => (a -> Bool) -> Getting (Endo [a]) s s a a -> Fold s [a]

Obtain a `Fold` by splitting another `Fold`, `Lens`, `Getter` or `Traversal` into words, with word boundaries indicated by the given predicate.

Equivalent to ``splitting` `.` `dropBlanks` `.` `dropDelims` `.` `whenElt``.

     wordingBy :: (a -> Bool) -> Fold a -> Fold s [a]

liningBy :: Eq a => (a -> Bool) -> Getting (Endo [a]) s s a a -> Fold s [a]

Obtain a `Fold` by splitting another `Fold`, `Lens`, `Getter` or `Traversal` into lines, with line boundaries indicated by the given predicate.

Equivalent to ``splitting` `.` `dropFinalBlank` `.` `dropDelims` `.` `whenElt``.

     liningBy :: (a -> Bool) -> Fold s a -> Fold s [a]

chunking

Arguments

:: Int |
    n
-> Getting (Endo [a]) s s a a |
-> Fold s [a] |

Obtain a `Fold` by splitting another `Fold`, `Lens`, `Getter` or `Traversal` into length-`n` pieces.

     chunkingOf :: Int -> Fold s a -> Fold s [a]

splittingPlaces :: Integral n => [n] -> Getting (Endo [a]) s s a a -> Fold s [a]

Obtain a `Fold` by splitting another `Fold`, `Lens`, `Getter` or `Traversal` into chunks of the given lengths, .

     splittingPlaces :: Integral n => [n] -> Fold s a -> Fold s [a]

splittingPlacesBlanks :: Integral n => [n] -> Getting (Endo [a]) s s a a -> Fold s [a]

Obtain a `Fold` by splitting another `Fold`, `Lens`, `Getter` or `Traversal` into chunks of the given lengths. Unlike `splittingPlaces`, the output `Fold` will always be the same length as the first input argument.

     splittingPlacesBlanks :: Integral n => [n] -> Fold s a -> Fold s [a]

# Lenses for `Splitter` Internals

delimiters :: Lens (Splitter a) (Splitter b) [a -> Bool] [b -> Bool]

Modify or retrieve the list of delimiters for a `Splitter`.

delimiting :: Lens' (Splitter a) DelimPolicy

Modify or retrieve the policy for what a `Splitter` to do with delimiters.

condensing :: Lens' (Splitter a) Bool

Modify or retrieve the policy for what a `Splitter` should about consecutive delimiters.

keepInitialBlanks :: Lens' (Splitter a) Bool

Modify or retrieve the policy for whether a `Splitter` should drop an initial blank.

keepFinalBlanks :: Lens' (Splitter a) Bool

Modify or retrieve the policy for whether a `Splitter` should drop a final blank.