/usr/share/doc/libghc-blaze-builder-doc/html/Blaze-ByteString-Builder-Internal.html is in libghc-blaze-builder-doc 0.3.3.2-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 | <!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.Internal</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-Internal.html");};
//]]>
</script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="src/Blaze-ByteString-Builder-Internal.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-0.3.3.2: Efficient buffered output.</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 <iridcode@gmail.com></td></tr><tr><th>Safe Haskell</th><td>None</td></tr></table><p class="caption">Blaze.ByteString.Builder.Internal</p></div><div id="table-of-contents"><p class="caption">Contents</p><ul><li><a href="#g:1">Build Steps
</a></li><li><a href="#g:2">Builder
</a></li><li><a href="#g:3">Put
</a></li><li><a href="#g:4">Writes
</a></li><li><a href="#g:5">Execution
</a></li><li><a href="#g:6">Deafult Sizes
</a></li></ul></div><div id="description"><p class="caption">Description</p><div class="doc"><p>Core types and functions for the <code><a href="Blaze-ByteString-Builder-Internal.html#t:Builder">Builder</a></code> monoid and the <code><a href="Blaze-ByteString-Builder-Internal.html#t:Put">Put</a></code> monad.
</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:BufRange">BufRange</a> = <a href="#v:BufRange">BufRange</a> !(<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Foreign-Ptr.html#t:Ptr">Ptr</a> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Word.html#t:Word8">Word8</a>) !(<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Foreign-Ptr.html#t:Ptr">Ptr</a> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Word.html#t:Word8">Word8</a>)</li><li class="src short"><span class="keyword">data</span> <a href="#t:BuildSignal">BuildSignal</a> a</li><li class="src short"><span class="keyword">data</span> <a href="#t:BuildStep">BuildStep</a> a</li><li class="src short"><a href="#v:done">done</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Foreign-Ptr.html#t:Ptr">Ptr</a> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Word.html#t:Word8">Word8</a> -> a -> <a href="Blaze-ByteString-Builder-Internal.html#t:BuildSignal">BuildSignal</a> a</li><li class="src short"><a href="#v:bufferFull">bufferFull</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Int.html#t:Int">Int</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Foreign-Ptr.html#t:Ptr">Ptr</a> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Word.html#t:Word8">Word8</a> -> (<a href="Blaze-ByteString-Builder-Internal.html#t:BufRange">BufRange</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/System-IO.html#t:IO">IO</a> (<a href="Blaze-ByteString-Builder-Internal.html#t:BuildSignal">BuildSignal</a> a)) -> <a href="Blaze-ByteString-Builder-Internal.html#t:BuildSignal">BuildSignal</a> a</li><li class="src short"><a href="#v:insertByteString">insertByteString</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Foreign-Ptr.html#t:Ptr">Ptr</a> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Word.html#t:Word8">Word8</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.0.2/Data-ByteString.html#t:ByteString">ByteString</a> -> (<a href="Blaze-ByteString-Builder-Internal.html#t:BufRange">BufRange</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/System-IO.html#t:IO">IO</a> (<a href="Blaze-ByteString-Builder-Internal.html#t:BuildSignal">BuildSignal</a> a)) -> <a href="Blaze-ByteString-Builder-Internal.html#t:BuildSignal">BuildSignal</a> a</li><li class="src short"><span class="keyword">data</span> <a href="#t:Builder">Builder</a> </li><li class="src short"><a href="#v:fromBuildStepCont">fromBuildStepCont</a> :: (<span class="keyword">forall</span> r. (<a href="Blaze-ByteString-Builder-Internal.html#t:BufRange">BufRange</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/System-IO.html#t:IO">IO</a> (<a href="Blaze-ByteString-Builder-Internal.html#t:BuildSignal">BuildSignal</a> r)) -> <a href="Blaze-ByteString-Builder-Internal.html#t:BufRange">BufRange</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/System-IO.html#t:IO">IO</a> (<a href="Blaze-ByteString-Builder-Internal.html#t:BuildSignal">BuildSignal</a> r)) -> <a href="Blaze-ByteString-Builder-Internal.html#t:Builder">Builder</a></li><li class="src short"><a href="#v:fromPut">fromPut</a> :: <a href="Blaze-ByteString-Builder-Internal.html#t:Put">Put</a> a -> <a href="Blaze-ByteString-Builder-Internal.html#t:Builder">Builder</a></li><li class="src short"><a href="#v:flush">flush</a> :: <a href="Blaze-ByteString-Builder-Internal.html#t:Builder">Builder</a></li><li class="src short"><span class="keyword">data</span> <a href="#t:Put">Put</a> a</li><li class="src short"><a href="#v:putBuilder">putBuilder</a> :: <a href="Blaze-ByteString-Builder-Internal.html#t:Builder">Builder</a> -> <a href="Blaze-ByteString-Builder-Internal.html#t:Put">Put</a> ()</li><li class="src short"><a href="#v:putBuildStepCont">putBuildStepCont</a> :: (<span class="keyword">forall</span> r. (a -> <a href="Blaze-ByteString-Builder-Internal.html#t:BufRange">BufRange</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/System-IO.html#t:IO">IO</a> (<a href="Blaze-ByteString-Builder-Internal.html#t:BuildSignal">BuildSignal</a> r)) -> <a href="Blaze-ByteString-Builder-Internal.html#t:BufRange">BufRange</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/System-IO.html#t:IO">IO</a> (<a href="Blaze-ByteString-Builder-Internal.html#t:BuildSignal">BuildSignal</a> r)) -> <a href="Blaze-ByteString-Builder-Internal.html#t:Put">Put</a> a</li><li class="src short"><a href="#v:putLiftIO">putLiftIO</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/System-IO.html#t:IO">IO</a> a -> <a href="Blaze-ByteString-Builder-Internal.html#t:Put">Put</a> a</li><li class="src short">module <a href="Blaze-ByteString-Builder-Internal-Write.html">Blaze.ByteString.Builder.Internal.Write</a></li><li class="src short"><a href="#v:writeToByteString">writeToByteString</a> :: <a href="Blaze-ByteString-Builder-Internal-Write.html#t:Write">Write</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.0.2/Data-ByteString.html#t:ByteString">ByteString</a></li><li class="src short"><a href="#v:toLazyByteString">toLazyByteString</a> :: <a href="Blaze-ByteString-Builder-Internal.html#t:Builder">Builder</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.0.2/Data-ByteString-Lazy.html#t:ByteString">ByteString</a></li><li class="src short"><a href="#v:toLazyByteStringWith">toLazyByteStringWith</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Int.html#t:Int">Int</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Int.html#t:Int">Int</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Int.html#t:Int">Int</a> -> <a href="Blaze-ByteString-Builder-Internal.html#t:Builder">Builder</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.0.2/Data-ByteString-Lazy.html#t:ByteString">ByteString</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.0.2/Data-ByteString-Lazy.html#t:ByteString">ByteString</a></li><li class="src short"><a href="#v:toByteString">toByteString</a> :: <a href="Blaze-ByteString-Builder-Internal.html#t:Builder">Builder</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.0.2/Data-ByteString.html#t:ByteString">ByteString</a></li><li class="src short"><a href="#v:toByteStringIO">toByteStringIO</a> :: (<a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.0.2/Data-ByteString.html#t:ByteString">ByteString</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/System-IO.html#t:IO">IO</a> ()) -> <a href="Blaze-ByteString-Builder-Internal.html#t:Builder">Builder</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/System-IO.html#t:IO">IO</a> ()</li><li class="src short"><a href="#v:toByteStringIOWith">toByteStringIOWith</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Int.html#t:Int">Int</a> -> (<a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.0.2/Data-ByteString.html#t:ByteString">ByteString</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/System-IO.html#t:IO">IO</a> ()) -> <a href="Blaze-ByteString-Builder-Internal.html#t:Builder">Builder</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/System-IO.html#t:IO">IO</a> ()</li><li class="src short"><a href="#v:defaultFirstBufferSize">defaultFirstBufferSize</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Int.html#t:Int">Int</a></li><li class="src short"><a href="#v:defaultMinimalBufferSize">defaultMinimalBufferSize</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Int.html#t:Int">Int</a></li><li class="src short"><a href="#v:defaultBufferSize">defaultBufferSize</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Int.html#t:Int">Int</a></li><li class="src short"><a href="#v:defaultMaximalCopySize">defaultMaximalCopySize</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Int.html#t:Int">Int</a></li></ul></div><div id="interface"><h1 id="g:1">Build Steps
</h1><div class="top"><p class="src"><span class="keyword">data</span> <a name="t:BufRange" class="def">BufRange</a> <a href="src/Blaze-ByteString-Builder-Internal-Types.html#BufRange" class="link">Source</a></p><div class="subs constructors"><p class="caption">Constructors</p><table><tr><td class="src"><a name="v:BufRange" class="def">BufRange</a> !(<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Foreign-Ptr.html#t:Ptr">Ptr</a> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Word.html#t:Word8">Word8</a>) !(<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Foreign-Ptr.html#t:Ptr">Ptr</a> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Word.html#t:Word8">Word8</a>)</td><td class="doc empty"> </td></tr></table></div></div><div class="top"><p class="src"><span class="keyword">data</span> <a name="t:BuildSignal" class="def">BuildSignal</a> a <a href="src/Blaze-ByteString-Builder-Internal-Types.html#BuildSignal" class="link">Source</a></p></div><div class="top"><p class="src"><span class="keyword">data</span> <a name="t:BuildStep" class="def">BuildStep</a> a <a href="src/Blaze-ByteString-Builder-Internal-Types.html#BuildStep" class="link">Source</a></p></div><div class="top"><p class="src"><a name="v:done" class="def">done</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Foreign-Ptr.html#t:Ptr">Ptr</a> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Word.html#t:Word8">Word8</a> -> a -> <a href="Blaze-ByteString-Builder-Internal.html#t:BuildSignal">BuildSignal</a> a<a href="src/Blaze-ByteString-Builder-Internal-Types.html#done" class="link">Source</a></p></div><div class="top"><p class="src"><a name="v:bufferFull" class="def">bufferFull</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Int.html#t:Int">Int</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Foreign-Ptr.html#t:Ptr">Ptr</a> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Word.html#t:Word8">Word8</a> -> (<a href="Blaze-ByteString-Builder-Internal.html#t:BufRange">BufRange</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/System-IO.html#t:IO">IO</a> (<a href="Blaze-ByteString-Builder-Internal.html#t:BuildSignal">BuildSignal</a> a)) -> <a href="Blaze-ByteString-Builder-Internal.html#t:BuildSignal">BuildSignal</a> a<a href="src/Blaze-ByteString-Builder-Internal-Types.html#bufferFull" class="link">Source</a></p></div><div class="top"><p class="src"><a name="v:insertByteString" class="def">insertByteString</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Foreign-Ptr.html#t:Ptr">Ptr</a> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Word.html#t:Word8">Word8</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.0.2/Data-ByteString.html#t:ByteString">ByteString</a> -> (<a href="Blaze-ByteString-Builder-Internal.html#t:BufRange">BufRange</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/System-IO.html#t:IO">IO</a> (<a href="Blaze-ByteString-Builder-Internal.html#t:BuildSignal">BuildSignal</a> a)) -> <a href="Blaze-ByteString-Builder-Internal.html#t:BuildSignal">BuildSignal</a> a<a href="src/Blaze-ByteString-Builder-Internal-Types.html#insertByteString" class="link">Source</a></p></div><h1 id="g:2">Builder
</h1><div class="top"><p class="src"><span class="keyword">data</span> <a name="t:Builder" class="def">Builder</a> <a href="src/Blaze-ByteString-Builder-Internal-Types.html#Builder" class="link">Source</a></p><div class="subs instances"><p id="control.i:Builder" class="caption collapser" onclick="toggleSection('i:Builder')">Instances</p><div id="section.i:Builder" class="show"><table><tr><td class="src"><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Monoid.html#t:Monoid">Monoid</a> <a href="Blaze-ByteString-Builder-Internal.html#t:Builder">Builder</a></td><td class="doc empty"> </td></tr></table></div></div></div><div class="top"><p class="src"><a name="v:fromBuildStepCont" class="def">fromBuildStepCont</a> :: (<span class="keyword">forall</span> r. (<a href="Blaze-ByteString-Builder-Internal.html#t:BufRange">BufRange</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/System-IO.html#t:IO">IO</a> (<a href="Blaze-ByteString-Builder-Internal.html#t:BuildSignal">BuildSignal</a> r)) -> <a href="Blaze-ByteString-Builder-Internal.html#t:BufRange">BufRange</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/System-IO.html#t:IO">IO</a> (<a href="Blaze-ByteString-Builder-Internal.html#t:BuildSignal">BuildSignal</a> r)) -> <a href="Blaze-ByteString-Builder-Internal.html#t:Builder">Builder</a><a href="src/Blaze-ByteString-Builder-Internal-Types.html#fromBuildStepCont" class="link">Source</a></p></div><div class="top"><p class="src"><a name="v:fromPut" class="def">fromPut</a> :: <a href="Blaze-ByteString-Builder-Internal.html#t:Put">Put</a> a -> <a href="Blaze-ByteString-Builder-Internal.html#t:Builder">Builder</a><a href="src/Blaze-ByteString-Builder-Internal-Types.html#fromPut" class="link">Source</a></p><div class="doc"><p>Ignore the value of a put and only exploit its output side effect.
</p></div></div><div class="top"><p class="src"><a name="v:flush" class="def">flush</a> :: <a href="Blaze-ByteString-Builder-Internal.html#t:Builder">Builder</a><a href="src/Blaze-ByteString-Builder-Internal.html#flush" class="link">Source</a></p><div class="doc"><p>Output all data written in the current buffer and start a new chunk.
</p><p>The use of this function depends on how the resulting bytestrings are
consumed. <code><a href="Blaze-ByteString-Builder-Internal.html#v:flush">flush</a></code> is possibly not very useful in non-interactive scenarios.
However, it is kept for compatibility with the builder provided by
Data.Binary.Builder.
</p><p>When using <code><a href="Blaze-ByteString-Builder-Internal.html#v:toLazyByteString">toLazyByteString</a></code> to extract a lazy <code><a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.0.2/Data-ByteString-Lazy.html#t:ByteString">ByteString</a></code> from a
<code><a href="Blaze-ByteString-Builder-Internal.html#t:Builder">Builder</a></code>, this means that a new chunk will be started in the resulting lazy
<code><a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.0.2/Data-ByteString-Lazy.html#t:ByteString">ByteString</a></code>. The remaining part of the buffer is spilled, if the
reamining free space is smaller than the minimal desired buffer size.
</p></div></div><h1 id="g:3">Put
</h1><div class="top"><p class="src"><span class="keyword">data</span> <a name="t:Put" class="def">Put</a> a <a href="src/Blaze-ByteString-Builder-Internal-Types.html#Put" class="link">Source</a></p><div class="subs instances"><p id="control.i:Put" class="caption collapser" onclick="toggleSection('i:Put')">Instances</p><div id="section.i:Put" class="show"><table><tr><td class="src"><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Control-Monad.html#t:Monad">Monad</a> <a href="Blaze-ByteString-Builder-Internal.html#t:Put">Put</a></td><td class="doc empty"> </td></tr><tr><td class="src"><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Control-Monad.html#t:Functor">Functor</a> <a href="Blaze-ByteString-Builder-Internal.html#t:Put">Put</a></td><td class="doc empty"> </td></tr></table></div></div></div><div class="top"><p class="src"><a name="v:putBuilder" class="def">putBuilder</a> :: <a href="Blaze-ByteString-Builder-Internal.html#t:Builder">Builder</a> -> <a href="Blaze-ByteString-Builder-Internal.html#t:Put">Put</a> ()<a href="src/Blaze-ByteString-Builder-Internal-Types.html#putBuilder" class="link">Source</a></p><div class="doc"><p>Put the given builder.
</p></div></div><div class="top"><p class="src"><a name="v:putBuildStepCont" class="def">putBuildStepCont</a> :: (<span class="keyword">forall</span> r. (a -> <a href="Blaze-ByteString-Builder-Internal.html#t:BufRange">BufRange</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/System-IO.html#t:IO">IO</a> (<a href="Blaze-ByteString-Builder-Internal.html#t:BuildSignal">BuildSignal</a> r)) -> <a href="Blaze-ByteString-Builder-Internal.html#t:BufRange">BufRange</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/System-IO.html#t:IO">IO</a> (<a href="Blaze-ByteString-Builder-Internal.html#t:BuildSignal">BuildSignal</a> r)) -> <a href="Blaze-ByteString-Builder-Internal.html#t:Put">Put</a> a<a href="src/Blaze-ByteString-Builder-Internal-Types.html#putBuildStepCont" class="link">Source</a></p></div><div class="top"><p class="src"><a name="v:putLiftIO" class="def">putLiftIO</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/System-IO.html#t:IO">IO</a> a -> <a href="Blaze-ByteString-Builder-Internal.html#t:Put">Put</a> a<a href="src/Blaze-ByteString-Builder-Internal-Types.html#putLiftIO" class="link">Source</a></p><div class="doc"><p>Lift the given IO action.
</p></div></div><h1 id="g:4">Writes
</h1><div class="top"><p class="src">module <a href="Blaze-ByteString-Builder-Internal-Write.html">Blaze.ByteString.Builder.Internal.Write</a></p></div><div class="top"><p class="src"><a name="v:writeToByteString" class="def">writeToByteString</a> :: <a href="Blaze-ByteString-Builder-Internal-Write.html#t:Write">Write</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.0.2/Data-ByteString.html#t:ByteString">ByteString</a><a href="src/Blaze-ByteString-Builder-Internal.html#writeToByteString" class="link">Source</a></p><div class="doc"><p>Run a <code><a href="Blaze-ByteString-Builder-Internal-Write.html#t:Write">Write</a></code> to produce a strict <code><a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.0.2/Data-ByteString.html#t:ByteString">ByteString</a></code>.
This is equivalent to <code>(<code><a href="Blaze-ByteString-Builder-Internal.html#v:toByteString">toByteString</a></code> . <code><a href="Blaze-ByteString-Builder-Internal-Write.html#v:fromWrite">fromWrite</a></code>)</code>, but is more
efficient because it uses just one appropriately-sized buffer.
</p></div></div><h1 id="g:5">Execution
</h1><div class="top"><p class="src"><a name="v:toLazyByteString" class="def">toLazyByteString</a> :: <a href="Blaze-ByteString-Builder-Internal.html#t:Builder">Builder</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.0.2/Data-ByteString-Lazy.html#t:ByteString">ByteString</a><a href="src/Blaze-ByteString-Builder-Internal.html#toLazyByteString" class="link">Source</a></p><div class="doc"><p>Extract the lazy <code><a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.0.2/Data-ByteString-Lazy.html#t:ByteString">ByteString</a></code> from the builder by running it with default
buffer sizes. Use this function, if you do not have any special
considerations with respect to buffer sizes.
</p><pre> <code><a href="Blaze-ByteString-Builder-Internal.html#v:toLazyByteString">toLazyByteString</a></code> b = <code><a href="Blaze-ByteString-Builder-Internal.html#v:toLazyByteStringWith">toLazyByteStringWith</a></code> <code><a href="Blaze-ByteString-Builder-Internal.html#v:defaultBufferSize">defaultBufferSize</a></code> <code><a href="Blaze-ByteString-Builder-Internal.html#v:defaultMinimalBufferSize">defaultMinimalBufferSize</a></code> <code><a href="Blaze-ByteString-Builder-Internal.html#v:defaultFirstBufferSize">defaultFirstBufferSize</a></code> b L.empty</pre><p>Note that <code><code><a href="Blaze-ByteString-Builder-Internal.html#v:toLazyByteString">toLazyByteString</a></code></code> is a <code>Monoid</code> homomorphism.
</p><pre> toLazyByteString mempty == mempty
toLazyByteString (x `mappend` y) == toLazyByteString x `mappend` toLazyByteString y
</pre><p>However, in the second equation, the left-hand-side is generally faster to
execute.
</p></div></div><div class="top"><p class="src"><a name="v:toLazyByteStringWith" class="def">toLazyByteStringWith</a><a href="src/Blaze-ByteString-Builder-Internal.html#toLazyByteStringWith" class="link">Source</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Int.html#t:Int">Int</a></td><td class="doc"><p>Buffer size (upper-bounds the resulting chunk size).
</p></td></tr><tr><td class="src">-> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Int.html#t:Int">Int</a></td><td class="doc"><p>Minimal free buffer space for continuing filling
the same buffer after a <code><a href="Blaze-ByteString-Builder-Internal.html#v:flush">flush</a></code> or a direct bytestring
insertion. This corresponds to the minimal desired
chunk size.
</p></td></tr><tr><td class="src">-> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Int.html#t:Int">Int</a></td><td class="doc"><p>Size of the first buffer to be used and copied for
larger resulting sequences
</p></td></tr><tr><td class="src">-> <a href="Blaze-ByteString-Builder-Internal.html#t:Builder">Builder</a></td><td class="doc"><p>Builder to run.
</p></td></tr><tr><td class="src">-> <a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.0.2/Data-ByteString-Lazy.html#t:ByteString">ByteString</a></td><td class="doc"><p>Lazy bytestring to output after the builder is
finished.
</p></td></tr><tr><td class="src">-> <a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.0.2/Data-ByteString-Lazy.html#t:ByteString">ByteString</a></td><td class="doc"><p>Resulting lazy bytestring
</p></td></tr></table></div><div class="doc"><p>Run a <code><a href="Blaze-ByteString-Builder-Internal.html#t:Builder">Builder</a></code> with the given buffer sizes.
</p><p>Use this function for integrating the <code><a href="Blaze-ByteString-Builder-Internal.html#t:Builder">Builder</a></code> type with other libraries
that generate lazy bytestrings.
</p><p>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.
</p><p>A call <code>toLazyByteStringWith bufSize minBufSize firstBufSize</code> will generate
a lazy bytestring according to the following strategy. First, we allocate
a buffer of size <code>firstBufSize</code> and start filling it. If it overflows, we
allocate a buffer of size <code>minBufSize</code> and copy the first buffer to it in
order to avoid generating a too small chunk. Finally, every next buffer will
be of size <code>bufSize</code>. 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.
</p><p>Note that setting <code>firstBufSize >= minBufSize</code> implies that the first buffer
is no longer copied but allocated and filled directly. Hence, setting
<code>firstBufSize = bufSize</code> means that all chunks will use an underlying buffer
of size <code>bufSize</code>. This is recommended, if you know that you always output
more than <code>minBufSize</code> bytes.
</p></div></div><div class="top"><p class="src"><a name="v:toByteString" class="def">toByteString</a> :: <a href="Blaze-ByteString-Builder-Internal.html#t:Builder">Builder</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.0.2/Data-ByteString.html#t:ByteString">ByteString</a><a href="src/Blaze-ByteString-Builder-Internal.html#toByteString" class="link">Source</a></p><div class="doc"><p>Run the builder to construct a strict bytestring containing the sequence
of bytes denoted by the builder. This is done by first serializing to a lazy bytestring and then packing its
chunks to a appropriately sized strict bytestring.
</p><pre> toByteString = packChunks . toLazyByteString
</pre><p>Note that <code><code><a href="Blaze-ByteString-Builder-Internal.html#v:toByteString">toByteString</a></code></code> is a <code>Monoid</code> homomorphism.
</p><pre> toByteString mempty == mempty
toByteString (x `mappend` y) == toByteString x `mappend` toByteString y
</pre><p>However, in the second equation, the left-hand-side is generally faster to
execute.
</p></div></div><div class="top"><p class="src"><a name="v:toByteStringIO" class="def">toByteStringIO</a> :: (<a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.0.2/Data-ByteString.html#t:ByteString">ByteString</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/System-IO.html#t:IO">IO</a> ()) -> <a href="Blaze-ByteString-Builder-Internal.html#t:Builder">Builder</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/System-IO.html#t:IO">IO</a> ()<a href="src/Blaze-ByteString-Builder-Internal.html#toByteStringIO" class="link">Source</a></p><div class="doc"><p>Run the builder with a <code><a href="Blaze-ByteString-Builder-Internal.html#v:defaultBufferSize">defaultBufferSize</a></code>d buffer and execute the given
<code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/System-IO.html#t:IO">IO</a></code> action whenever the buffer is full or gets flushed.
</p><pre> <code><a href="Blaze-ByteString-Builder-Internal.html#v:toByteStringIO">toByteStringIO</a></code> = <code><a href="Blaze-ByteString-Builder-Internal.html#v:toByteStringIOWith">toByteStringIOWith</a></code> <code><a href="Blaze-ByteString-Builder-Internal.html#v:defaultBufferSize">defaultBufferSize</a></code></pre><p>This is a <code>Monoid</code> homomorphism in the following sense.
</p><pre> toByteStringIO io mempty == return ()
toByteStringIO io (x `mappend` y) == toByteStringIO io x >> toByteStringIO io y
</pre></div></div><div class="top"><p class="src"><a name="v:toByteStringIOWith" class="def">toByteStringIOWith</a><a href="src/Blaze-ByteString-Builder-Internal.html#toByteStringIOWith" class="link">Source</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Int.html#t:Int">Int</a></td><td class="doc"><p>Buffer size (upper bounds
the number of bytes forced
per call to the <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/System-IO.html#t:IO">IO</a></code> action).
</p></td></tr><tr><td class="src">-> (<a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.0.2/Data-ByteString.html#t:ByteString">ByteString</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/System-IO.html#t:IO">IO</a> ())</td><td class="doc"><p><code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/System-IO.html#t:IO">IO</a></code> action to execute per
full buffer, which is
referenced by a strict
<code><a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.0.2/Data-ByteString.html#t:ByteString">ByteString</a></code>.
</p></td></tr><tr><td class="src">-> <a href="Blaze-ByteString-Builder-Internal.html#t:Builder">Builder</a></td><td class="doc"><p><code><a href="Blaze-ByteString-Builder-Internal.html#t:Builder">Builder</a></code> to run.
</p></td></tr><tr><td class="src">-> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/System-IO.html#t:IO">IO</a> ()</td><td class="doc"><p>Resulting <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/System-IO.html#t:IO">IO</a></code> action.
</p></td></tr></table></div><div class="doc"><p><code>toByteStringIOWith bufSize io b</code> runs the builder <code>b</code> with a buffer of
at least the size <code>bufSize</code> and executes the <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/System-IO.html#t:IO">IO</a></code> action <code>io</code> whenever the
buffer is full.
</p><p>Compared to <code><a href="Blaze-ByteString-Builder-Internal.html#v:toLazyByteStringWith">toLazyByteStringWith</a></code> 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.
</p></div></div><h1 id="g:6">Deafult Sizes
</h1><div class="top"><p class="src"><a name="v:defaultFirstBufferSize" class="def">defaultFirstBufferSize</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Int.html#t:Int">Int</a><a href="src/Blaze-ByteString-Builder-Internal.html#defaultFirstBufferSize" class="link">Source</a></p><div class="doc"><p>The default length (64) for the first buffer to be allocated when
converting a <code><a href="Blaze-ByteString-Builder-Internal.html#t:Builder">Builder</a></code> to a lazy bytestring.
</p><p>See <code><a href="Blaze-ByteString-Builder-Internal.html#v:toLazyByteStringWith">toLazyByteStringWith</a></code> for further explanation.
</p></div></div><div class="top"><p class="src"><a name="v:defaultMinimalBufferSize" class="def">defaultMinimalBufferSize</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Int.html#t:Int">Int</a><a href="src/Blaze-ByteString-Builder-Internal.html#defaultMinimalBufferSize" class="link">Source</a></p><div class="doc"><p>The minimal length (~4kb) a buffer must have before filling it and
outputting it as a chunk of the output stream.
</p><p>This size determines when a buffer is spilled after a <code><a href="Blaze-ByteString-Builder-Internal.html#v:flush">flush</a></code> or a direct
bytestring insertion. It is also the size of the first chunk generated by
<code><a href="Blaze-ByteString-Builder-Internal.html#v:toLazyByteString">toLazyByteString</a></code>.
</p></div></div><div class="top"><p class="src"><a name="v:defaultBufferSize" class="def">defaultBufferSize</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Int.html#t:Int">Int</a><a href="src/Blaze-ByteString-Builder-Internal.html#defaultBufferSize" class="link">Source</a></p><div class="doc"><p>Default size (~32kb) for the buffer that becomes a chunk of the output
stream once it is filled.
</p></div></div><div class="top"><p class="src"><a name="v:defaultMaximalCopySize" class="def">defaultMaximalCopySize</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Int.html#t:Int">Int</a><a href="src/Blaze-ByteString-Builder-Internal.html#defaultMaximalCopySize" class="link">Source</a></p><div class="doc"><p>The maximal number of bytes for that copying is cheaper than direct
insertion into the output stream. This takes into account the fragmentation
that may occur in the output buffer due to the early <code><a href="Blaze-ByteString-Builder-Internal.html#v:flush">flush</a></code> implied by the
direct bytestring insertion.
</p><pre><code><a href="Blaze-ByteString-Builder-Internal.html#v:defaultMaximalCopySize">defaultMaximalCopySize</a></code> = 2 * <code><a href="Blaze-ByteString-Builder-Internal.html#v:defaultMinimalBufferSize">defaultMinimalBufferSize</a></code></pre></div></div></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.13.2</p></div></body></html>
|