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

Safe Haskell | Safe
Language | Haskell98

Control.Foldl.Text

Contents

- Folding
- Folds
- Re-exports

Description

Folds for text streams

Synopsis

- fold :: Fold Text a -> Text -> a
- foldM :: Monad m => FoldM m Text a -> Text -> m a
- head :: Fold Text (Maybe Char)
- last :: Fold Text (Maybe Char)
- null :: Fold Text Bool
- length :: Num n => Fold Text n
- any :: (Char -> Bool) -> Fold Text Bool
- all :: (Char -> Bool) -> Fold Text Bool
- maximum :: Fold Text (Maybe Char)
- minimum :: Fold Text (Maybe Char)
- elem :: Char -> Fold Text Bool
- notElem :: Char -> Fold Text Bool
- find :: (Char -> Bool) -> Fold Text (Maybe Char)
- index :: Integral n => n -> Fold Text (Maybe Char)
- elemIndex :: Num n => Char -> Fold Text (Maybe n)
- findIndex :: Num n => (Char -> Bool) -> Fold Text (Maybe n)
- count :: Num n => Char -> Fold Text n
- lazy :: Fold Text Text
- module Control.Foldl
- module Data.Text

# Folding

fold :: Fold Text a -> Text -> a #

Apply a strict left `Fold` to lazy text

foldM :: Monad m => FoldM m Text a -> Text -> m a #

Apply a strict monadic left `FoldM` to lazy text

# Folds

head :: Fold Text (Maybe Char) #

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

last :: Fold Text (Maybe Char) #

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

null :: Fold Text Bool #

Returns `True` if the text stream is empty, `False` otherwise

length :: Num n => Fold Text n #

Return the length of the text stream in characters

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

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

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

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

maximum :: Fold Text (Maybe Char) #

Computes the maximum character

minimum :: Fold Text (Maybe Char) #

Computes the minimum character

elem :: Char -> Fold Text Bool #

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

notElem :: Char -> Fold Text Bool #

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

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

`(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) #

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

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

`(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) #

`(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 n #

`(count c)` returns the number of times `c` appears

lazy :: Fold Text Text #

Combine all the strict `Text` chunks to build a lazy `Text`

# Re-exports

Control.Foldl re-exports the `Fold` type

`Data.Text` re-exports the `Text` type

module Control.Foldl

module Data.Text