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

Safe Haskell | None
Language | Haskell98

Control.Foldl.ByteString

Contents

- Folding
- Folds
- Re-exports

Description

Folds for byte streams

Synopsis

- fold :: Fold ByteString a -> ByteString -> a
- head :: Fold ByteString (Maybe Word8)
- last :: Fold ByteString (Maybe Word8)
- null :: Fold ByteString Bool
- length :: Num n => Fold ByteString n
- any :: (Word8 -> Bool) -> Fold ByteString Bool
- all :: (Word8 -> Bool) -> Fold ByteString Bool
- maximum :: Fold ByteString (Maybe Word8)
- minimum :: Fold ByteString (Maybe Word8)
- elem :: Word8 -> Fold ByteString Bool
- notElem :: Word8 -> Fold ByteString Bool
- find :: (Word8 -> Bool) -> Fold ByteString (Maybe Word8)
- index :: Integral n => n -> Fold ByteString (Maybe Word8)
- elemIndex :: Num n => Word8 -> Fold ByteString (Maybe n)
- findIndex :: Num n => (Word8 -> Bool) -> Fold ByteString (Maybe n)
- count :: Num n => Word8 -> Fold ByteString n
- module Control.Foldl
- module Data.ByteString
- module Data.Word

# Folding

fold :: Fold ByteString a -> ByteString -> a Source

Apply a strict left `Fold` to a lazy bytestring

# Folds

head :: Fold ByteString (Maybe Word8) Source

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

last :: Fold ByteString (Maybe Word8) Source

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

null :: Fold ByteString Bool Source

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

length :: Num n => Fold ByteString n Source

Return the length of the byte stream in bytes

any :: (Word8 -> Bool) -> Fold ByteString Bool Source

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

all :: (Word8 -> Bool) -> Fold ByteString Bool Source

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

maximum :: Fold ByteString (Maybe Word8) Source

Computes the maximum byte

minimum :: Fold ByteString (Maybe Word8) Source

Computes the minimum byte

elem :: Word8 -> Fold ByteString Bool Source

`(elem w8)` returns `True` if the byte stream has a byte equal to `w8`, `False` otherwise

notElem :: Word8 -> Fold ByteString Bool Source

`(notElem w8)` returns `False` if the byte stream has a byte equal to `w8`, `True` otherwise

find :: (Word8 -> Bool) -> Fold ByteString (Maybe Word8) Source

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

index :: Integral n => n -> Fold ByteString (Maybe Word8) Source

`(index n)` returns the `n`th byte of the byte stream, or `Nothing` if the stream has an insufficient number of bytes

elemIndex :: Num n => Word8 -> Fold ByteString (Maybe n) Source

`(elemIndex w8)` returns the index of the first byte that equals `w8`, or `Nothing` if no byte matches

findIndex :: Num n => (Word8 -> Bool) -> Fold ByteString (Maybe n) Source

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

count :: Num n => Word8 -> Fold ByteString n Source

`count w8` returns the number of times `w8` appears

# Re-exports

Control.Foldl re-exports the `Fold` type

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

`Data.Word` re-exports the `Word8` type

module Control.Foldl

module Data.ByteString

module Data.Word