Sophie

Sophie

distrib > Fedora > 16 > i386 > by-pkgid > 67e4318061e913d7cb8b84a26fdcc0f6 > files > 13

ghc-blaze-builder-enumerator-devel-0.2.0.3-1.fc16.i686.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Blaze.ByteString.Builder.Enumerator</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script type="text/javascript">//<![CDATA[
window.onload = function () {pageLoad();setSynopsis("mini_Blaze-ByteString-Builder-Enumerator.html");};
//]]>
</script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="src/Blaze-ByteString-Builder-Enumerator.html">Source</a></li><li><a href="index.html">Contents</a></li><li><a href="doc-index.html">Index</a></li></ul><p class="caption">blaze-builder-enumerator-0.2.0.3: Enumeratees for the incremental conversion of builders to
bytestrings.</p></div><div id="content"><div id="module-header"><table class="info"><tr><th>Portability</th><td>Tested on GHC only</td></tr><tr><th>Stability</th><td>Experimental</td></tr><tr><th>Maintainer</th><td>Simon Meier &lt;iridcode@gmail.com&gt;</td></tr></table><p class="caption">Blaze.ByteString.Builder.Enumerator</p></div><div id="table-of-contents"><p class="caption">Contents</p><ul><li><a href="#g:1">Buffers
</a><ul><li><a href="#g:2">Status information
</a></li><li><a href="#g:3">Creation and modification
</a></li><li><a href="#g:4">Conversion to bytestings
</a></li></ul></li><li><a href="#g:5">Buffer allocation strategies
</a></li><li><a href="#g:6">Enumeratees from builders to bytestrings
</a></li></ul></div><div id="description"><p class="caption">Description</p><div class="doc"><p>Infrastructure and enumeratees for the incremental execution of builders and
 passing on of the filled chunks as bytestrings to an inner iteratee.
</p><p>Note that the <code>Buffer</code> code is likely to move/change in order to
 reconciliate it with the rest of the blaze-builder library.
</p></div></div><div id="synopsis"><p id="control.syn" class="caption expander" onclick="toggleSection('syn')">Synopsis</p><ul id="section.syn" class="hide" onclick="toggleSection('syn')"><li class="src short"><span class="keyword">data</span>  <a href="#t:Buffer">Buffer</a> </li><li class="src short"><a href="#v:freeSize">freeSize</a> :: <a href="Blaze-ByteString-Builder-Enumerator.html#t:Buffer">Buffer</a> -&gt; <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Int.html#t:Int">Int</a></li><li class="src short"><a href="#v:sliceSize">sliceSize</a> :: <a href="Blaze-ByteString-Builder-Enumerator.html#t:Buffer">Buffer</a> -&gt; <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Int.html#t:Int">Int</a></li><li class="src short"><a href="#v:bufferSize">bufferSize</a> :: <a href="Blaze-ByteString-Builder-Enumerator.html#t:Buffer">Buffer</a> -&gt; <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Int.html#t:Int">Int</a></li><li class="src short"><a href="#v:allocBuffer">allocBuffer</a> :: <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Int.html#t:Int">Int</a> -&gt; <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> <a href="Blaze-ByteString-Builder-Enumerator.html#t:Buffer">Buffer</a></li><li class="src short"><a href="#v:reuseBuffer">reuseBuffer</a> :: <a href="Blaze-ByteString-Builder-Enumerator.html#t:Buffer">Buffer</a> -&gt; <a href="Blaze-ByteString-Builder-Enumerator.html#t:Buffer">Buffer</a></li><li class="src short"><a href="#v:nextSlice">nextSlice</a> :: <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Int.html#t:Int">Int</a> -&gt; <a href="Blaze-ByteString-Builder-Enumerator.html#t:Buffer">Buffer</a> -&gt; <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Maybe.html#t:Maybe">Maybe</a> <a href="Blaze-ByteString-Builder-Enumerator.html#t:Buffer">Buffer</a></li><li class="src short"><a href="#v:unsafeFreezeBuffer">unsafeFreezeBuffer</a> :: <a href="Blaze-ByteString-Builder-Enumerator.html#t:Buffer">Buffer</a> -&gt; <a href="/usr/share/doc/ghc/html/libraries/bytestring-0.9.1.10/Data-ByteString.html#t:ByteString">ByteString</a></li><li class="src short"><a href="#v:unsafeFreezeNonEmptyBuffer">unsafeFreezeNonEmptyBuffer</a> :: <a href="Blaze-ByteString-Builder-Enumerator.html#t:Buffer">Buffer</a> -&gt; <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Maybe.html#t:Maybe">Maybe</a> <a href="/usr/share/doc/ghc/html/libraries/bytestring-0.9.1.10/Data-ByteString.html#t:ByteString">ByteString</a></li><li class="src short"><span class="keyword">type</span> <a href="#t:BufferAllocStrategy">BufferAllocStrategy</a> = (<a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> <a href="Blaze-ByteString-Builder-Enumerator.html#t:Buffer">Buffer</a>, <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Int.html#t:Int">Int</a> -&gt; <a href="Blaze-ByteString-Builder-Enumerator.html#t:Buffer">Buffer</a> -&gt; <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> (<a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> <a href="Blaze-ByteString-Builder-Enumerator.html#t:Buffer">Buffer</a>))</li><li class="src short"><a href="#v:allNewBuffersStrategy">allNewBuffersStrategy</a> :: <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Int.html#t:Int">Int</a> -&gt; <a href="Blaze-ByteString-Builder-Enumerator.html#t:BufferAllocStrategy">BufferAllocStrategy</a></li><li class="src short"><a href="#v:reuseBufferStrategy">reuseBufferStrategy</a> :: <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> <a href="Blaze-ByteString-Builder-Enumerator.html#t:Buffer">Buffer</a> -&gt; <a href="Blaze-ByteString-Builder-Enumerator.html#t:BufferAllocStrategy">BufferAllocStrategy</a></li><li class="src short"><a href="#v:builderToByteString">builderToByteString</a> :: <a href="/usr/share/doc/ghc/html/libraries/transformers-0.2.2.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m =&gt; <a href="/usr/share/doc/ghc/html/libraries/enumerator-0.4.13.1/Data-Enumerator.html#t:Enumeratee">Enumeratee</a> <a href="/usr/share/doc/ghc/html/libraries/blaze-builder-0.3.0.1/Blaze-ByteString-Builder-Internal-Types.html#t:Builder">Builder</a> <a href="/usr/share/doc/ghc/html/libraries/bytestring-0.9.1.10/Data-ByteString.html#t:ByteString">ByteString</a> m a</li><li class="src short"><a href="#v:unsafeBuilderToByteString">unsafeBuilderToByteString</a> :: <a href="/usr/share/doc/ghc/html/libraries/transformers-0.2.2.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m =&gt; <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> <a href="Blaze-ByteString-Builder-Enumerator.html#t:Buffer">Buffer</a> -&gt; <a href="/usr/share/doc/ghc/html/libraries/enumerator-0.4.13.1/Data-Enumerator.html#t:Enumeratee">Enumeratee</a> <a href="/usr/share/doc/ghc/html/libraries/blaze-builder-0.3.0.1/Blaze-ByteString-Builder-Internal-Types.html#t:Builder">Builder</a> <a href="/usr/share/doc/ghc/html/libraries/bytestring-0.9.1.10/Data-ByteString.html#t:ByteString">ByteString</a> m a</li><li class="src short"><a href="#v:builderToByteStringWith">builderToByteStringWith</a> :: <a href="/usr/share/doc/ghc/html/libraries/transformers-0.2.2.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m =&gt; <a href="Blaze-ByteString-Builder-Enumerator.html#t:BufferAllocStrategy">BufferAllocStrategy</a> -&gt; <a href="/usr/share/doc/ghc/html/libraries/enumerator-0.4.13.1/Data-Enumerator.html#t:Enumeratee">Enumeratee</a> <a href="/usr/share/doc/ghc/html/libraries/blaze-builder-0.3.0.1/Blaze-ByteString-Builder-Internal-Types.html#t:Builder">Builder</a> <a href="/usr/share/doc/ghc/html/libraries/bytestring-0.9.1.10/Data-ByteString.html#t:ByteString">ByteString</a> m a</li></ul></div><div id="interface"><h1 id="g:1">Buffers
</h1><div class="top"><p class="src"><span class="keyword">data</span>  <a name="t:Buffer" class="def">Buffer</a>  </p><div class="doc"><p>A buffer <code>Buffer fpbuf p0 op ope</code> describes a buffer with the underlying
 byte array <code>fpbuf..ope</code>, the currently written slice <code>p0..op</code> and the free
 space <code>op..ope</code>.
</p></div></div><h2 id="g:2">Status information
</h2><div class="top"><p class="src"><a name="v:freeSize" class="def">freeSize</a> :: <a href="Blaze-ByteString-Builder-Enumerator.html#t:Buffer">Buffer</a> -&gt; <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Int.html#t:Int">Int</a></p><div class="doc"><p>The size of the free space of the buffer.
</p></div></div><div class="top"><p class="src"><a name="v:sliceSize" class="def">sliceSize</a> :: <a href="Blaze-ByteString-Builder-Enumerator.html#t:Buffer">Buffer</a> -&gt; <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Int.html#t:Int">Int</a></p><div class="doc"><p>The size of the written slice in the buffer.
</p></div></div><div class="top"><p class="src"><a name="v:bufferSize" class="def">bufferSize</a> :: <a href="Blaze-ByteString-Builder-Enumerator.html#t:Buffer">Buffer</a> -&gt; <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Int.html#t:Int">Int</a></p><div class="doc"><p>The size of the whole byte array underlying the buffer.
</p></div></div><h2 id="g:3">Creation and modification
</h2><div class="top"><p class="src"><a name="v:allocBuffer" class="def">allocBuffer</a> :: <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Int.html#t:Int">Int</a> -&gt; <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> <a href="Blaze-ByteString-Builder-Enumerator.html#t:Buffer">Buffer</a></p><div class="doc"><p><code>allocBuffer size</code> allocates a new buffer of size <code>size</code>.
</p></div></div><div class="top"><p class="src"><a name="v:reuseBuffer" class="def">reuseBuffer</a> :: <a href="Blaze-ByteString-Builder-Enumerator.html#t:Buffer">Buffer</a> -&gt; <a href="Blaze-ByteString-Builder-Enumerator.html#t:Buffer">Buffer</a></p><div class="doc"><p>Resets the beginning of the next slice and the next free byte such that
 the whole buffer can be filled again.
</p></div></div><div class="top"><p class="src"><a name="v:nextSlice" class="def">nextSlice</a> :: <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Int.html#t:Int">Int</a> -&gt; <a href="Blaze-ByteString-Builder-Enumerator.html#t:Buffer">Buffer</a> -&gt; <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Maybe.html#t:Maybe">Maybe</a> <a href="Blaze-ByteString-Builder-Enumerator.html#t:Buffer">Buffer</a></p><div class="doc"><p>Move the beginning of the slice to the next free byte such that the
 remaining free space of the buffer can be filled further. This operation
 is safe and can be used to fill the remaining part of the buffer after a
 direct insertion of a bytestring or a flush.
</p></div></div><h2 id="g:4">Conversion to bytestings
</h2><div class="top"><p class="src"><a name="v:unsafeFreezeBuffer" class="def">unsafeFreezeBuffer</a> :: <a href="Blaze-ByteString-Builder-Enumerator.html#t:Buffer">Buffer</a> -&gt; <a href="/usr/share/doc/ghc/html/libraries/bytestring-0.9.1.10/Data-ByteString.html#t:ByteString">ByteString</a></p><div class="doc"><p>Convert the buffer to a bytestring. This operation is unsafe in the sense
 that created bytestring shares the underlying byte array with the buffer.
 Hence, depending on the later use of this buffer (e.g., if it gets reset and
 filled again) referential transparency may be lost.
</p></div></div><div class="top"><p class="src"><a name="v:unsafeFreezeNonEmptyBuffer" class="def">unsafeFreezeNonEmptyBuffer</a> :: <a href="Blaze-ByteString-Builder-Enumerator.html#t:Buffer">Buffer</a> -&gt; <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Maybe.html#t:Maybe">Maybe</a> <a href="/usr/share/doc/ghc/html/libraries/bytestring-0.9.1.10/Data-ByteString.html#t:ByteString">ByteString</a></p><div class="doc"><p>Convert a buffer to a non-empty bytestring. See <code><a href="Blaze-ByteString-Builder-Enumerator.html#v:unsafeFreezeBuffer">unsafeFreezeBuffer</a></code> for
 the explanation of why this operation may be unsafe.
</p></div></div><h1 id="g:5">Buffer allocation strategies
</h1><div class="top"><p class="src"><span class="keyword">type</span> <a name="t:BufferAllocStrategy" class="def">BufferAllocStrategy</a> = (<a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> <a href="Blaze-ByteString-Builder-Enumerator.html#t:Buffer">Buffer</a>, <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Int.html#t:Int">Int</a> -&gt; <a href="Blaze-ByteString-Builder-Enumerator.html#t:Buffer">Buffer</a> -&gt; <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> (<a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> <a href="Blaze-ByteString-Builder-Enumerator.html#t:Buffer">Buffer</a>))</p><div class="doc"><p>A buffer allocation strategy <code>(buf0, nextBuf)</code> specifies the initial
 buffer to use and how to compute a new buffer <code>nextBuf minSize buf</code> with at
 least size <code>minSize</code> from a filled buffer <code>buf</code>. The double nesting of the
 <code>IO</code> monad helps to ensure that the reference to the filled buffer <code>buf</code> is
 lost as soon as possible, but the new buffer doesn't have to be allocated 
 too early.
</p></div></div><div class="top"><p class="src"><a name="v:allNewBuffersStrategy" class="def">allNewBuffersStrategy</a> :: <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Int.html#t:Int">Int</a> -&gt; <a href="Blaze-ByteString-Builder-Enumerator.html#t:BufferAllocStrategy">BufferAllocStrategy</a></p><div class="doc"><p>The simplest buffer allocation strategy: whenever a buffer is requested,
 allocate a new one that is big enough for the next build step to execute.
</p><p>NOTE that this allocation strategy may spill quite some memory upon direct
 insertion of a bytestring by the builder. Thats no problem for garbage
 collection, but it may lead to unreasonably high memory consumption in
 special circumstances.
</p></div></div><div class="top"><p class="src"><a name="v:reuseBufferStrategy" class="def">reuseBufferStrategy</a> :: <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> <a href="Blaze-ByteString-Builder-Enumerator.html#t:Buffer">Buffer</a> -&gt; <a href="Blaze-ByteString-Builder-Enumerator.html#t:BufferAllocStrategy">BufferAllocStrategy</a></p><div class="doc"><p>An unsafe, but possibly more efficient buffer allocation strategy:
 reuse the buffer, if it is big enough for the next build step to execute.
</p></div></div><h1 id="g:6">Enumeratees from builders to bytestrings
</h1><div class="top"><p class="src"><a name="v:builderToByteString" class="def">builderToByteString</a> :: <a href="/usr/share/doc/ghc/html/libraries/transformers-0.2.2.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m =&gt; <a href="/usr/share/doc/ghc/html/libraries/enumerator-0.4.13.1/Data-Enumerator.html#t:Enumeratee">Enumeratee</a> <a href="/usr/share/doc/ghc/html/libraries/blaze-builder-0.3.0.1/Blaze-ByteString-Builder-Internal-Types.html#t:Builder">Builder</a> <a href="/usr/share/doc/ghc/html/libraries/bytestring-0.9.1.10/Data-ByteString.html#t:ByteString">ByteString</a> m a<a href="src/Blaze-ByteString-Builder-Enumerator.html#builderToByteString" class="link">Source</a></p><div class="doc"><p>Incrementally execute builders and pass on the filled chunks as
 bytestrings.
</p></div></div><div class="top"><p class="src"><a name="v:unsafeBuilderToByteString" class="def">unsafeBuilderToByteString</a> :: <a href="/usr/share/doc/ghc/html/libraries/transformers-0.2.2.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m =&gt; <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> <a href="Blaze-ByteString-Builder-Enumerator.html#t:Buffer">Buffer</a> -&gt; <a href="/usr/share/doc/ghc/html/libraries/enumerator-0.4.13.1/Data-Enumerator.html#t:Enumeratee">Enumeratee</a> <a href="/usr/share/doc/ghc/html/libraries/blaze-builder-0.3.0.1/Blaze-ByteString-Builder-Internal-Types.html#t:Builder">Builder</a> <a href="/usr/share/doc/ghc/html/libraries/bytestring-0.9.1.10/Data-ByteString.html#t:ByteString">ByteString</a> m a<a href="src/Blaze-ByteString-Builder-Enumerator.html#unsafeBuilderToByteString" class="link">Source</a></p><div class="doc"><p>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.
</p><p>WARNING: This enumeratee yields bytestrings that are NOT
 referentially transparent. Their content will be overwritten as soon
 as control is returned from the inner iteratee!
</p></div></div><div class="top"><p class="src"><a name="v:builderToByteStringWith" class="def">builderToByteStringWith</a> :: <a href="/usr/share/doc/ghc/html/libraries/transformers-0.2.2.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m =&gt; <a href="Blaze-ByteString-Builder-Enumerator.html#t:BufferAllocStrategy">BufferAllocStrategy</a> -&gt; <a href="/usr/share/doc/ghc/html/libraries/enumerator-0.4.13.1/Data-Enumerator.html#t:Enumeratee">Enumeratee</a> <a href="/usr/share/doc/ghc/html/libraries/blaze-builder-0.3.0.1/Blaze-ByteString-Builder-Internal-Types.html#t:Builder">Builder</a> <a href="/usr/share/doc/ghc/html/libraries/bytestring-0.9.1.10/Data-ByteString.html#t:ByteString">ByteString</a> m a<a href="src/Blaze-ByteString-Builder-Enumerator.html#builderToByteStringWith" class="link">Source</a></p><div class="doc"><p>An enumeratee that incrementally executes builders and passes on the
 filled chunks as bytestrings to an inner iteratee.
</p><p>INV: All bytestrings passed to the inner iteratee are non-empty.
</p></div></div></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.9.2</p></div></body></html>