Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- data Bytes
- null :: Bytes -> Bool
- length :: Bytes -> Int
- takeWhile :: (Word8 -> Bool) -> Bytes -> Bytes
- dropWhile :: (Word8 -> Bool) -> Bytes -> Bytes
- foldl :: (a -> Word8 -> a) -> a -> Bytes -> a
- foldl' :: (a -> Word8 -> a) -> a -> Bytes -> a
- foldr :: (Word8 -> a -> a) -> a -> Bytes -> a
- foldr' :: (Word8 -> a -> a) -> a -> Bytes -> a
- isPrefixOf :: Bytes -> Bytes -> Bool
- isSuffixOf :: Bytes -> Bytes -> Bool
- unsafeTake :: Int -> Bytes -> Bytes
- unsafeDrop :: Int -> Bytes -> Bytes
- toByteArray :: Bytes -> ByteArray
- toByteArrayClone :: Bytes -> ByteArray
- fromAsciiString :: String -> Bytes
- fromByteArray :: ByteArray -> Bytes
Types
A slice of a ByteArray
.
Properties
Filtering
Folds
foldl :: (a -> Word8 -> a) -> a -> Bytes -> a Source #
Left fold over bytes, non-strict in the accumulator.
foldl' :: (a -> Word8 -> a) -> a -> Bytes -> a Source #
Left fold over bytes, strict in the accumulator.
foldr :: (Word8 -> a -> a) -> a -> Bytes -> a Source #
Right fold over bytes, non-strict in the accumulator.
foldr' :: (Word8 -> a -> a) -> a -> Bytes -> a Source #
Right fold over bytes, strict in the accumulator.
Equality
Unsafe Slicing
unsafeTake :: Int -> Bytes -> Bytes Source #
Take the first n
bytes from the argument. Precondition: n ≤ len
unsafeDrop :: Int -> Bytes -> Bytes Source #
Drop the first n
bytes from the argument. Precondition: n ≤ len
Conversion
toByteArray :: Bytes -> ByteArray Source #
toByteArrayClone :: Bytes -> ByteArray Source #
Variant of toByteArray
that unconditionally makes a copy of
the array backing the sliced Bytes
even if the original array
could be reused. Prefer toByteArray
.