Data.Bytes.Builder.Bounded.Unsafe

bytebuild-0.3.16.3: Build byte arrays

Safe Haskell | None
Language | Haskell2010

Data.Bytes.Builder.Bounded.Unsafe

Contents

- Types
- Construct
- Run

Synopsis

- newtype Builder (a :: Nat) where
  - Builder :: forall (a :: Nat). (forall s. MutableByteArray# s -> Int# -> State# s -> (# State# s, Int# #)) -> Builder a
- construct :: forall (n :: Nat). (forall s. MutableByteArray s -> Int -> ST s Int) -> Builder n
- pasteST :: forall (n :: Nat) s. Builder n -> MutableByteArray s -> Int -> ST s Int
- pasteIO :: forall (n :: Nat). Builder n -> MutableByteArray RealWorld -> Int -> IO Int

# Types

newtype Builder (a :: Nat) where #

A builder parameterized by the maximum number of bytes it uses when executed.

Constructors

Builder |
Fields :: forall (a :: Nat). (forall s. MutableByteArray# s -> Int# -> State# s -> (# State# s, Int# #)) This function takes a buffer, an offset, and a number of remaining bytes. It returns the new offset. -> Builder a

#### Instances

Instances details

ToBoundedBuilder (Builder n) # | Identity
Instance details Defined in Data.Bytes.Builder.Bounded.Class Associated Types
type BoundedBuilderLength (Builder n) |
Instance details Defined in Data.Bytes.Builder.Bounded.Class type BoundedBuilderLength (Builder n) = n
Methods toBuilder :: Builder n -> Builder (BoundedBuilderLength (Builder n)) #
type BoundedBuilderLength (Builder n) # |
Instance details Defined in Data.Bytes.Builder.Bounded.Class type BoundedBuilderLength (Builder n) = n

# Construct

construct :: forall (n :: Nat). (forall s. MutableByteArray s -> Int -> ST s Int) -> Builder n #

Constructor for `Builder` that works on a function with lifted arguments instead of unlifted ones. This is just as unsafe as the actual constructor.

# Run

pasteST :: forall (n :: Nat) s. Builder n -> MutableByteArray s -> Int -> ST s Int #

This function does not enforce the known upper bound on the size. It is up to the user to do this.

pasteIO :: forall (n :: Nat). Builder n -> MutableByteArray RealWorld -> Int -> IO Int #

This function does not enforce the known upper bound on the size. It is up to the user to do this.