blaze-builder-0.3.3.0: Efficient buffered output.

Portability | tested on GHC only
Stability | experimental
Maintainer | Simon Meier <iridcode@gmail.com>
Safe Haskell | None

Blaze.ByteString.Builder.Internal.Types

Description

Core types and functions for the `Builder` monoid and the `Put` monad based based on the 'blaze-builder' library by Jasper van der Jeugt and Simon Meier.

Synopsis

- data BufRange = BufRange !(Ptr Word8) !(Ptr Word8)
- data BuildSignal a
  - = Done !(Ptr Word8) a
  - | BufferFull !Int !(Ptr Word8) !(BuildStep a)
  - | InsertByteString !(Ptr Word8) !ByteString !(BuildStep a)
- newtype BuildStep a = BuildStep {
  - runBuildStep :: BufRange -> IO (BuildSignal a)
  }
- done :: Ptr Word8 -> a -> BuildSignal a
- bufferFull :: Int -> Ptr Word8 -> (BufRange -> IO (BuildSignal a)) -> BuildSignal a
- insertByteString :: Ptr Word8 -> ByteString -> (BufRange -> IO (BuildSignal a)) -> BuildSignal a
- buildStep :: (BufRange -> IO (BuildSignal a)) -> BuildStep a
- newtype Builder = Builder {
  - unBuilder :: forall r. BuildStep r -> BuildStep r
  }
- newtype Put a = Put {
  - unPut :: forall r. (a -> BuildStep r) -> BuildStep r
  }
- putBuildStepCont :: (forall r. (a -> BufRange -> IO (BuildSignal r)) -> BufRange -> IO (BuildSignal r)) -> Put a
- fromBuildStepCont :: (forall r. (BufRange -> IO (BuildSignal r)) -> BufRange -> IO (BuildSignal r)) -> Builder
- putBuilder :: Builder -> Put ()
- fromPut :: Put a -> Builder
- putLiftIO :: IO a -> Put a

# Documentation

data BufRange Source

Constructors

BufRange !(Ptr Word8) !(Ptr Word8) |

data BuildSignal a Source

Constructors

Done !(Ptr Word8) a |
BufferFull !Int !(Ptr Word8) !(BuildStep a) |
InsertByteString !(Ptr Word8) !ByteString !(BuildStep a) |

newtype BuildStep a Source

Constructors

BuildStep |

Fields

runBuildStep :: BufRange -> IO (BuildSignal a)

done :: Ptr Word8 -> a -> BuildSignal aSource

bufferFull :: Int -> Ptr Word8 -> (BufRange -> IO (BuildSignal a)) -> BuildSignal aSource

insertByteString :: Ptr Word8 -> ByteString -> (BufRange -> IO (BuildSignal a)) -> BuildSignal aSource

buildStep :: (BufRange -> IO (BuildSignal a)) -> BuildStep aSource

newtype Builder Source

Constructors

Builder |

Fields

unBuilder :: forall r. BuildStep r -> BuildStep r

Instances

Monoid Builder |

newtype Put a Source

Constructors

Put |

Fields

unPut :: forall r. (a -> BuildStep r) -> BuildStep r

Instances

Monad Put |
Functor Put |

putBuildStepCont :: (forall r. (a -> BufRange -> IO (BuildSignal r)) -> BufRange -> IO (BuildSignal r)) -> Put aSource

fromBuildStepCont :: (forall r. (BufRange -> IO (BuildSignal r)) -> BufRange -> IO (BuildSignal r)) -> Builder Source

putBuilder :: Builder -> Put ()Source

Put the given builder.

fromPut :: Put a -> Builder Source

Ignore the value of a put and only exploit its output side effect.

putLiftIO :: IO a -> Put aSource

Lift the given IO action.