rio-0.1.8.0: A standard library for Haskell

Safe Haskell | Safe
Language | Haskell2010

RIO.ByteString.Partial

Contents

- Basic interface
- Reducing `ByteString`s (folds)
- Special folds

Description

This module exports all the partial functions from `ByteString`

Synopsis

- head :: ByteString -> Word8
- last :: ByteString -> Word8
- tail :: ByteString -> ByteString
- init :: ByteString -> ByteString
- foldl1 :: (Word8 -> Word8 -> Word8) -> ByteString -> Word8
- foldl1' :: (Word8 -> Word8 -> Word8) -> ByteString -> Word8
- foldr1 :: (Word8 -> Word8 -> Word8) -> ByteString -> Word8
- foldr1' :: (Word8 -> Word8 -> Word8) -> ByteString -> Word8
- maximum :: ByteString -> Word8
- minimum :: ByteString -> Word8

# Basic interface

head :: ByteString -> Word8 Source #

O(1) Extract the first element of a ByteString, which must be non-empty. An exception will be thrown in the case of an empty ByteString.

last :: ByteString -> Word8 Source #

O(1) Extract the last element of a ByteString, which must be finite and non-empty. An exception will be thrown in the case of an empty ByteString.

tail :: ByteString -> ByteString Source #

O(1) Extract the elements after the head of a ByteString, which must be non-empty. An exception will be thrown in the case of an empty ByteString.

init :: ByteString -> ByteString Source #

O(1) Return all the elements of a `ByteString` except the last one. An exception will be thrown in the case of an empty ByteString.

# Reducing `ByteString`s (folds)

foldl1 :: (Word8 -> Word8 -> Word8) -> ByteString -> Word8 Source #

`foldl1` is a variant of `foldl` that has no starting value argument, and thus must be applied to non-empty `ByteStrings`. An exception will be thrown in the case of an empty ByteString.

foldl1' :: (Word8 -> Word8 -> Word8) -> ByteString -> Word8 Source #

'foldl1\'' is like `foldl1`, but strict in the accumulator. An exception will be thrown in the case of an empty ByteString.

foldr1 :: (Word8 -> Word8 -> Word8) -> ByteString -> Word8 Source #

`foldr1` is a variant of `foldr` that has no starting value argument, and thus must be applied to non-empty `ByteString`s An exception will be thrown in the case of an empty ByteString.

foldr1' :: (Word8 -> Word8 -> Word8) -> ByteString -> Word8 Source #

'foldr1\'' is a variant of `foldr1`, but is strict in the accumulator.

# Special folds

maximum :: ByteString -> Word8 Source #

O(n) `maximum` returns the maximum value from a `ByteString` This function will fuse. An exception will be thrown in the case of an empty ByteString.

minimum :: ByteString -> Word8 Source #

O(n) `minimum` returns the minimum value from a `ByteString` This function will fuse. An exception will be thrown in the case of an empty ByteString.