| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Data.ByteArray.Builder.Unsafe
Synopsis
- newtype Builder = Builder (forall s. MutableByteArray# s -> Int# -> Int# -> Commits s -> State# s -> (#State# s, MutableByteArray# s, Int#, Int#, Commits s#))
- data Commits s
- = Mutable (MutableByteArray# s) Int# !(Commits s)
- | Immutable ByteArray# Int# Int# !(Commits s)
- | Initial
- fromEffect :: Int -> (forall s. MutableByteArray s -> Int -> ST s Int) -> Builder
- reverseCommitsOntoChunks :: Chunks -> Commits s -> ST s Chunks
- stringUtf8 :: String -> Builder
- cstring :: CString -> Builder
Types
An unmaterialized sequence of bytes that may be pasted into a mutable byte array.
Constructors
| Builder (forall s. MutableByteArray# s -> Int# -> Int# -> Commits s -> State# s -> (#State# s, MutableByteArray# s, Int#, Int#, Commits s#)) |
Constructors
| Mutable | |
Fields
| |
| Immutable | |
Fields
| |
| Initial | |
Construction
Finalization
reverseCommitsOntoChunks :: Chunks -> Commits s -> ST s Chunks Source #
Cons the chunks from a list of Commits onto an initial
Chunks list (this argument is often ChunksNil). This reverses
the order of the chunks, which is desirable since builders assemble
Commits with the chunks backwards. This performs an in-place shrink
and freezes on any mutable byte arrays it encounters. Consequently,
these must not be reused.
Safe Functions
These functions are actually completely safe, but they are defined
here because they are used by typeclass instances. Import them from
Data.ByteArray.Builder instead.