foldl-1.0.7: Composable, streaming, and efficient left folds

Safe HaskellSafe-Infered

Control.Foldl.Text

Contents

Description

Folds for text streams

Synopsis

Folding

fold :: Fold Text a -> Text -> aSource

Apply a strict left Fold to lazy text

Folds

head :: Fold Text (Maybe Char)Source

Get the first character of a text stream or return Nothing if the stream is empty

last :: Fold Text (Maybe Char)Source

Get the last character of a text stream or return Nothing if the text stream is empty

null :: Fold Text BoolSource

Returns True if the text stream is empty, False otherwise

length :: Num n => Fold Text nSource

Return the length of the text stream in characters

any :: (Char -> Bool) -> Fold Text BoolSource

(any predicate) returns True if any character satisfies the predicate, False otherwise

all :: (Char -> Bool) -> Fold Text BoolSource

(all predicate) returns True if all characters satisfy the predicate, False otherwise

maximum :: Fold Text (Maybe Char)Source

Computes the maximum character

minimum :: Fold Text (Maybe Char)Source

Computes the minimum character

elem :: Char -> Fold Text BoolSource

(elem c) returns True if the text stream has a character equal to c, False otherwise

notElem :: Char -> Fold Text BoolSource

(notElem c) returns False if the text stream has a character equal to c, True otherwise

find :: (Char -> Bool) -> Fold Text (Maybe Char)Source

(find predicate) returns the first character that satisfies the predicate or Nothing if no character satisfies the predicate

index :: Integral n => n -> Fold Text (Maybe Char)Source

(index n) returns the nth character of the text stream, or Nothing if the stream has an insufficient number of characters

elemIndex :: Num n => Char -> Fold Text (Maybe n)Source

(elemIndex c) returns the index of the first character that equals c, or Nothing if no character matches

findIndex :: Num n => (Char -> Bool) -> Fold Text (Maybe n)Source

(findIndex predicate) returns the index of the first character that satisfies the predicate, or Nothing if no character satisfies the predicate

count :: Num n => Char -> Fold Text nSource

(count c) returns the number of times c appears

Re-exports

Control.Foldl re-exports the Fold type

Data.Text re-exports the Text type

module Data.Text