conduit-extra-1.1.6.2: Batteries included conduit: adapters for common libraries.

Safe HaskellNone
LanguageHaskell98

Data.Conduit.Blaze

Contents

Description

Convert a stream of blaze-builder Builders into a stream of ByteStrings.

Adapted from blaze-builder-enumerator, written by myself and Simon Meier.

Note that the functions here can work in any monad built on top of IO or ST.

Synopsis

Conduits from builders to bytestrings

builderToByteString :: (MonadBase base m, PrimMonad base) => Conduit Builder m ByteString Source

Incrementally execute builders and pass on the filled chunks as bytestrings.

unsafeBuilderToByteString :: (MonadBase base m, PrimMonad base) => IO Buffer -> Conduit Builder m ByteString Source

Incrementally execute builders on the given buffer and pass on the filled chunks as bytestrings. Note that, if the given buffer is too small for the execution of a build step, a larger one will be allocated.

WARNING: This conduit yields bytestrings that are NOT referentially transparent. Their content will be overwritten as soon as control is returned from the inner sink!

builderToByteStringWith :: (MonadBase base m, PrimMonad base) => BufferAllocStrategy -> Conduit Builder m ByteString Source

A conduit that incrementally executes builders and passes on the filled chunks as bytestrings to an inner sink.

INV: All bytestrings passed to the inner sink are non-empty.

Flush

builderToByteStringFlush :: (MonadBase base m, PrimMonad base) => Conduit (Flush Builder) m (Flush ByteString) Source

Since 0.0.2

builderToByteStringWithFlush :: (MonadBase base m, PrimMonad base) => BufferAllocStrategy -> Conduit (Flush Builder) m (Flush ByteString) Source

Since 0.0.2

Buffers

data Buffer :: *

Status information

Creation and modification

Conversion to bytestings

Buffer allocation strategies