Hoogle Search

Within LTS Haskell 24.43 (ghc-9.10.3)

Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.

  1. toByteStringIO :: (ByteString -> IO ()) -> Builder -> IO ()

    blaze-builder Blaze.ByteString.Builder

    toByteStringIOWith bufSize io b runs the builder b with a buffer of at least the size bufSize and executes the IO action io whenever the buffer is full. Compared to toLazyByteStringWith this function requires less allocation, as the output buffer is only allocated once at the start of the serialization and whenever something bigger than the current buffer size has to be copied into the buffer, which should happen very seldomly for the default buffer size of 32kb. Hence, the pressure on the garbage collector is reduced, which can be an advantage when building long sequences of bytes.

  2. toByteStringIOWith :: Int -> (ByteString -> IO ()) -> Builder -> IO ()

    blaze-builder Blaze.ByteString.Builder

    No documentation available.

  3. toLazyByteString :: Builder -> LazyByteString

    blaze-builder Blaze.ByteString.Builder

    Execute a Builder and return the generated chunks as a LazyByteString. The work is performed lazy, i.e., only when a chunk of the LazyByteString is forced.

  4. toLazyByteStringWith :: Int -> Int -> Int -> Builder -> ByteString -> ByteString

    blaze-builder Blaze.ByteString.Builder

    Run a Builder with the given buffer sizes. Use this function for integrating the Builder type with other libraries that generate lazy bytestrings. Note that the builders should guarantee that on average the desired chunk size is attained. Builders may decide to start a new buffer and not completely fill the existing buffer, if this is faster. However, they should not spill too much of the buffer, if they cannot compensate for it. FIXME: Note that the following paragraphs are not entirely correct as of blaze-builder-0.4: A call toLazyByteStringWith bufSize minBufSize firstBufSize will generate a lazy bytestring according to the following strategy. First, we allocate a buffer of size firstBufSize and start filling it. If it overflows, we allocate a buffer of size minBufSize and copy the first buffer to it in order to avoid generating a too small chunk. Finally, every next buffer will be of size bufSize. This, slow startup strategy is required to achieve good speed for short (<200 bytes) resulting bytestrings, as for them the allocation cost is of a large buffer cannot be compensated. Moreover, this strategy also allows us to avoid spilling too much memory for short resulting bytestrings. Note that setting firstBufSize >= minBufSize implies that the first buffer is no longer copied but allocated and filled directly. Hence, setting firstBufSize = bufSize means that all chunks will use an underlying buffer of size bufSize. This is recommended, if you know that you always output more than minBufSize bytes.

  5. writeToByteString :: Write -> ByteString

    blaze-builder Blaze.ByteString.Builder

    Run a Write to produce a strict ByteString. This is equivalent to (toByteString . fromWrite), but is more efficient because it uses just one appropriately-sized buffer.

  6. copyByteString :: ByteString -> Builder

    blaze-builder Blaze.ByteString.Builder.ByteString

    Construct a Builder that copies the strict ByteString. Use this function to create Builders from smallish (<= 4kb) ByteStrings or if you need to guarantee that the ByteString is not shared with the chunks generated by the Builder.

  7. copyLazyByteString :: ByteString -> Builder

    blaze-builder Blaze.ByteString.Builder.ByteString

    Construct a Builder that copies the lazy ByteString.

  8. fromByteString :: ByteString -> Builder

    blaze-builder Blaze.ByteString.Builder.ByteString

    Create a Builder denoting the same sequence of bytes as a strict ByteString. The Builder inserts large ByteStrings directly, but copies small ones to ensure that the generated chunks are large on average.

  9. fromByteStringWith :: Int -> ByteString -> Builder

    blaze-builder Blaze.ByteString.Builder.ByteString

    Construct a Builder that copies the strict ByteStrings, if it is smaller than the threshold, and inserts it directly otherwise. For example, fromByteStringWith 1024 copies strict ByteStrings whose size is less or equal to 1kb, and inserts them directly otherwise. This implies that the average chunk-size of the generated lazy ByteString may be as low as 513 bytes, as there could always be just a single byte between the directly inserted 1025 byte, strict ByteStrings.

  10. fromLazyByteString :: ByteString -> Builder

    blaze-builder Blaze.ByteString.Builder.ByteString

    Create a Builder denoting the same sequence of bytes as a lazy ByteString. The Builder inserts large chunks of the lazy ByteString directly, but copies small ones to ensure that the generated chunks are large on average.

Page 35 of many | Previous | Next