Copyright | (c) Alexey Kuleshevich 2020 |
---|---|
License | BSD3 |
Maintainer | Alexey Kuleshevich <alexey@kuleshevi.ch> |
Stability | experimental |
Portability | non-portable |
Safe Haskell | None |
Language | Haskell2010 |
Synopsis
- newtype MByteString s = MByteString ByteString
- data Builder
- toBuilderBytes :: Bytes p -> Builder
- fromBuilderBytes :: Builder -> Bytes Pin
- data ByteString = PS !(ForeignPtr Word8) !Int !Int
- toByteStringBytes :: Bytes Pin -> ByteString
- fromByteStringBytes :: Typeable p => ByteString -> Bytes p
- fromLazyByteStringBytes :: ByteString -> Bytes Pin
- withPtrByteString :: MonadPrim s m => ByteString -> (Ptr a -> m b) -> m b
- withNoHaltPtrByteString :: MonadUnliftPrim s m => ByteString -> (Ptr a -> m b) -> m b
- data ShortByteString = SBS ByteArray#
- toShortByteStringBytes :: Bytes p -> ShortByteString
- fromShortByteStringBytes :: ShortByteString -> Bytes Inc
- byteStringConvertError :: String -> a
Documentation
newtype MByteString s Source #
Mutable version of a ByteString
Instances
Conversion
Builder
s denote sequences of bytes.
They are Monoid
s where
mempty
is the zero-length sequence and
mappend
is concatenation, which runs in O(1).
ByteString
data ByteString #
A space-efficient representation of a Word8
vector, supporting many
efficient operations.
A ByteString
contains 8-bit bytes, or by using the operations from
Data.ByteString.Char8 it can be interpreted as containing 8-bit
characters.
PS !(ForeignPtr Word8) !Int !Int |
Instances
toByteStringBytes :: Bytes Pin -> ByteString Source #
O(1) - Cast an immutable Bytes
to an immutable ByteString
Since: 0.1.0
fromByteStringBytes :: Typeable p => ByteString -> Bytes p Source #
O(n) - Allocate Bytes
and fill them with the contents of a strict ByteString
fromLazyByteStringBytes :: ByteString -> Bytes Pin Source #
O(n) - Allocate Bytes
and fill them with the contents of a lazy ByteString
withPtrByteString :: MonadPrim s m => ByteString -> (Ptr a -> m b) -> m b Source #
withNoHaltPtrByteString :: MonadUnliftPrim s m => ByteString -> (Ptr a -> m b) -> m b Source #
ShortByteString
data ShortByteString #
A compact representation of a Word8
vector.
It has a lower memory overhead than a ByteString
and and does not
contribute to heap fragmentation. It can be converted to or from a
ByteString
(at the cost of copying the string data). It supports very few
other operations.
It is suitable for use as an internal representation for code that needs
to keep many short strings in memory, but it should not be used as an
interchange type. That is, it should not generally be used in public APIs.
The ByteString
type is usually more suitable for use in interfaces; it is
more flexible and it supports a wide range of operations.
Instances
toShortByteStringBytes :: Bytes p -> ShortByteString Source #
O(1) - Cast an immutable Bytes
to an immutable ShortByteString
Since: 0.1.0
fromShortByteStringBytes :: ShortByteString -> Bytes Inc Source #
O(1) - Cast an immutable ShortByteString
to an immutable Bytes
Since: 0.1.0
byteStringConvertError :: String -> a Source #