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

Safe HaskellSafe-Infered

Control.Foldl.ByteString

Contents

Description

Folds for byte streams

Synopsis

Folding

fold :: Fold ByteString a -> ByteString -> aSource

Appply 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 BoolSource

Returns True if the byte stream is empty, False otherwise

length :: Num n => Fold ByteString nSource

Return the length of the byte stream in bytes

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

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

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

(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 BoolSource

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

notElem :: Word8 -> Fold ByteString BoolSource

(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 nth 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 nSource

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 Data.Word