| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
RIO.ByteString.Partial
Description
Strict ByteString partial functions. Import as:
import qualified RIO.ByteString.Partial as B'
Synopsis
- head :: HasCallStack => ByteString -> Word8
- last :: HasCallStack => ByteString -> Word8
- tail :: HasCallStack => ByteString -> ByteString
- init :: HasCallStack => ByteString -> ByteString
- foldl1 :: HasCallStack => (Word8 -> Word8 -> Word8) -> ByteString -> Word8
- foldl1' :: HasCallStack => (Word8 -> Word8 -> Word8) -> ByteString -> Word8
- foldr1 :: HasCallStack => (Word8 -> Word8 -> Word8) -> ByteString -> Word8
- foldr1' :: HasCallStack => (Word8 -> Word8 -> Word8) -> ByteString -> Word8
- maximum :: HasCallStack => ByteString -> Word8
- minimum :: HasCallStack => ByteString -> Word8
Basic interface
head :: HasCallStack => ByteString -> Word8 #
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.
This is a partial function, consider using uncons instead.
last :: HasCallStack => ByteString -> Word8 #
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.
This is a partial function, consider using unsnoc instead.
tail :: HasCallStack => ByteString -> ByteString #
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.
This is a partial function, consider using uncons instead.
init :: HasCallStack => ByteString -> ByteString #
O(1) Returns all the elements of a ByteString except the last one.
An exception will be thrown in the case of an empty ByteString.
This is a partial function, consider using unsnoc instead.
Reducing ByteStrings (folds)
foldl1 :: HasCallStack => (Word8 -> Word8 -> Word8) -> ByteString -> Word8 #
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' :: HasCallStack => (Word8 -> Word8 -> Word8) -> ByteString -> Word8 #
foldr1 :: HasCallStack => (Word8 -> Word8 -> Word8) -> ByteString -> Word8 #
foldr1 is a variant of foldr 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.
foldr1' :: HasCallStack => (Word8 -> Word8 -> Word8) -> ByteString -> Word8 #
Special folds
maximum :: HasCallStack => ByteString -> Word8 #
O(n) maximum returns the maximum value from a ByteString
An exception will be thrown in the case of an empty ByteString.
minimum :: HasCallStack => ByteString -> Word8 #
O(n) minimum returns the minimum value from a ByteString
An exception will be thrown in the case of an empty ByteString.