Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- toArray :: ByteString -> Array Word8
- fromArray :: Array Word8 -> ByteString
- reader :: Monad m => Unfold m ByteString Word8
- writeN :: MonadIO m => Int -> Fold m Word8 ByteString
- write :: MonadIO m => Fold m Word8 ByteString
- read :: Monad m => Unfold m ByteString Word8
Documentation
toArray :: ByteString -> Array Word8 Source #
Convert a ByteString
to an array of Word8
. It can be done in constant
time only for GHC allocated memory. For foreign allocator allocated memory
there is a copy involved.
fromArray :: Array Word8 -> ByteString Source #
Convert an array of Word8
to a ByteString
.
Please ensure that the array is pinned when using this function.
reader :: Monad m => Unfold m ByteString Word8 Source #
Unfold a strict ByteString to a stream of Word8.
writeN :: MonadIO m => Int -> Fold m Word8 ByteString Source #
Fold a stream of Word8 to a strict ByteString of given size in bytes.