Safe Haskell | None |
---|---|
Language | Haskell2010 |
Flat.Memory
Description
Memory access primitives.
Includes code from the store-core package.
Synopsis
- chunksToByteString :: (Ptr Word8, [Int]) -> ByteString
- chunksToByteArray :: (Ptr Word8, [Int]) -> (ByteArray, Int)
- data ByteArray
- pokeByteArray :: ByteArray# -> Int -> Int -> Ptr Word8 -> IO (Ptr Word8)
- pokeByteString :: ByteString -> Ptr Word8 -> IO (Ptr Word8)
- unsafeCreateUptoN' :: Int -> (Ptr Word8 -> IO (Int, a)) -> (ByteString, a)
- minusPtr :: Ptr a -> Ptr b -> Int
- peekByteString :: Ptr Word8 -> Int -> ByteString
Documentation
chunksToByteString :: (Ptr Word8, [Int]) -> ByteString Source #
Lifted wrapper for ByteArray#
.
Since ByteArray#
is an unlifted type and not a member of kind Type
,
things like [ByteArray#]
or IO ByteArray#
are ill-typed. To work around this
inconvenience this module provides a standard lifted wrapper, inhabiting Type
.
Clients are expected to use ByteArray
in higher-level APIs,
but wrap and unwrap ByteArray
internally as they please
and use functions from GHC.Exts.
Since: base-4.17.0.0
Instances
NFData ByteArray | Since: deepseq-1.4.7.0 |
Defined in Control.DeepSeq | |
Monoid ByteArray | Since: base-4.17.0.0 |
Semigroup ByteArray | Since: base-4.17.0.0 |
Data ByteArray | Since: base-4.17.0.0 |
Defined in Data.Array.Byte Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> ByteArray -> c ByteArray # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c ByteArray # toConstr :: ByteArray -> Constr # dataTypeOf :: ByteArray -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c ByteArray) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ByteArray) # gmapT :: (forall b. Data b => b -> b) -> ByteArray -> ByteArray # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> ByteArray -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> ByteArray -> r # gmapQ :: (forall d. Data d => d -> u) -> ByteArray -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> ByteArray -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> ByteArray -> m ByteArray # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> ByteArray -> m ByteArray # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> ByteArray -> m ByteArray # | |
IsList ByteArray | Since: base-4.17.0.0 |
Show ByteArray | Since: base-4.17.0.0 |
Eq ByteArray | Since: base-4.17.0.0 |
Ord ByteArray | Non-lexicographic ordering. This compares the lengths of the byte arrays first and uses a lexicographic ordering if the lengths are equal. Subject to change between major versions. Since: base-4.17.0.0 |
Hashable ByteArray | This instance was available since 1.4.1.0 only for GHC-9.4+ Since: hashable-1.4.2.0 |
Defined in Data.Hashable.Class | |
Lift ByteArray | Since: template-haskell-2.19.0.0 |
type Item ByteArray | |
Defined in Data.Array.Byte |
pokeByteArray :: ByteArray# -> Int -> Int -> Ptr Word8 -> IO (Ptr Word8) Source #
Copy ByteArray to given pointer, returns new pointer
pokeByteString :: ByteString -> Ptr Word8 -> IO (Ptr Word8) Source #
Copy bytestring to given pointer, returns new pointer
unsafeCreateUptoN' :: Int -> (Ptr Word8 -> IO (Int, a)) -> (ByteString, a) Source #
minusPtr :: Ptr a -> Ptr b -> Int #
Computes the offset required to get from the second to the first argument. We have
p2 == p1 `plusPtr` (p2 `minusPtr` p1)
Arguments
:: Ptr Word8 | sourcePtr |
-> Int | sourceLen |
-> ByteString |
Create a new bytestring, copying sourceLen bytes from sourcePtr
Since: 0.6