E3;Q      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrs t u v w x y z { | } ~  tested on GHC only experimental Simon Meier <iridcode@gmail.com>NonePut the given builder. CIgnore the value of a put and only exploit its output side effect.       tested on GHC only experimental Simon Meier <iridcode@gmail.com>None &A write of a bounded number of bytes. A write to a buffer. $FIXME: Find better name: what about Poke ?  Extract the  action of a write. writeN size io- creates a write that denotes the writing of size bytes ! to a buffer using the IO action io . Note that io MUST write EXACTLY size  bytes to the buffer! exactWrite size io8 creates a bounded write that can later be converted to  a builder that writes exactly size bytes. Note that io MUST write  EXACTLY size bytes to the buffer! boundedWrite size write creates a bounded write from a write that does  not write more than size bytes.  Construct a / writing a list of data one element at a time. !Write a storable value. "BA builder that serializes a storable value. No alignment is done. #DA builder that serializes a list of storable values by writing them F consecutively. No alignment is done. Parsing information needs to be  provided externally.  !"#  !"# !"# !"#tested on GHC only experimental Simon Meier <iridcode@gmail.com>None$A buffer allocation strategy (buf0, nextBuf) specifies the initial / buffer to use and how to compute a new buffer nextBuf minSize buf with at  least size minSize from a filled buffer buf. The double nesting of the  IO? monad helps to ensure that the reference to the filled buffer buf is 3 lost as soon as possible, but the new buffer doesn't have to be allocated  too early. % A buffer Buffer fpbuf p0 op ope( describes a buffer with the underlying  byte array  fpbuf..ope, the currently written slice p0..op and the free  space op..ope. &*The size of the free space of the buffer. '-The size of the written slice in the buffer. (8The size of the whole byte array underlying the buffer. )allocBuffer size allocates a new buffer of size size. *HResets the beginning of the next slice and the next free byte such that ' the whole buffer can be filled again. +JConvert the buffer to a bytestring. This operation is unsafe in the sense K that created bytestring shares the underlying byte array with the buffer. N Hence, depending on the later use of this buffer (e.g., if it gets reset and 5 filled again) referential transparency may be lost. ,0Convert a buffer to a non-empty bytestring. See + for 6 the explanation of why this operation may be unsafe. -!Update the end of slice pointer. .*Execute a build step on the given buffer. /DMove the beginning of the slice to the next free byte such that the J remaining free space of the buffer can be filled further. This operation J is safe and can be used to fill the remaining part of the buffer after a . direct insertion of a bytestring or a flush. 0IThe simplest buffer allocation strategy: whenever a buffer is requested, K allocate a new one that is big enough for the next build step to execute. KNOTE that this allocation strategy may spill quite some memory upon direct H insertion of a bytestring by the builder. Thats no problem for garbage H collection, but it may lead to unreasonably high memory consumption in  special circumstances. 1CAn unsafe, but possibly more efficient buffer allocation strategy: K reuse the buffer, if it is big enough for the next build step to execute. 2Execute a put on a buffer. 2TODO: Generalize over buffer allocation strategy. $%&'()*+,-./012$%&'()*+,-./012%&'()*/-.+,$012$%&'()*+,-./012 tested on GHC only experimental Simon Meier <iridcode@gmail.com>Nonetested on GHC only experimental Simon Meier <iridcode@gmail.com>None 3GDefault size (~32kb) for the buffer that becomes a chunk of the output  stream once it is filled. 4CThe minimal length (~4kb) a buffer must have before filling it and 1 outputting it as a chunk of the output stream. 6This size determines when a buffer is spilled after a 7 or a direct K bytestring insertion. It is also the size of the first chunk generated by  9. 5BThe default length (64) for the first buffer to be allocated when  converting a  to a lazy bytestring. See 8 for further explanation. 6DThe maximal number of bytes for that copying is cheaper than direct M insertion into the output stream. This takes into account the fragmentation 6 that may occur in the output buffer due to the early 7 implied by the  direct bytestring insertion. 6 = 2 * 4&Prepend the chunk if it is non-empty. 7EOutput all data written in the current buffer and start a new chunk. FThe use uf this function depends on how the resulting bytestrings are  consumed. 7; is possibly not very useful in non-interactive scenarios. D However, it is kept for compatibility with the builder provided by  Data.Binary.Builder.  When using 9 to extract a lazy  from a  D, this means that a new chunk will be started in the resulting lazy  6. The remaining part of the buffer is spilled, if the G reamining free space is smaller than the minimal desired buffer size. 8Run a  with the given buffer sizes. &Use this function for integrating the  type with other libraries ! that generate lazy bytestrings. JNote that the builders should guarantee that on average the desired chunk E size is attained. Builders may decide to start a new buffer and not N completely fill the existing buffer, if this is faster. However, they should E not spill too much of the buffer, if they cannot compensate for it. A call 4toLazyByteStringWith bufSize minBufSize firstBufSize will generate K 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 N order to avoid generating a too small chunk. Finally, every next buffer will  be of size bufSize5. This, slow startup strategy is required to achieve  good speed for short (<2200 bytes) resulting bytestrings, as for them the L allocation cost is of a large buffer cannot be compensated. Moreover, this E strategy also allows us to avoid spilling too much memory for short  resulting bytestrings. Note that setting firstBufSize >= minBufSize implies that the first buffer G is no longer copied but allocated and filled directly. Hence, setting  firstBufSize = bufSize5 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. 9Extract the lazy - from the builder by running it with default A buffer sizes. Use this function, if you do not have any special . considerations with respect to buffer sizes.   9 b = 8 3 4 5 b L.empty Note that 9 is a Monoid homomorphism.  , toLazyByteString mempty == mempty U toLazyByteString (x `mappend` y) == toLazyByteString x `mappend` toLazyByteString y KHowever, in the second equation, the left-hand-side is generally faster to  execute. FPack the chunks of a lazy bytestring into a single strict bytestring. :IRun the builder to construct a strict bytestring containing the sequence n of bytes denoted by the builder. This is done by first serializing to a lazy bytestring and then packing its 4 chunks to a appropriately sized strict bytestring.  . toByteString = packChunks . toLazyByteString  Note that : is a Monoid homomorphism.  ( toByteString mempty == mempty I toByteString (x `mappend` y) == toByteString x `mappend` toByteString y KHowever, in the second equation, the left-hand-side is generally faster to  execute. ;toByteStringIOWith bufSize io b runs the builder b with a buffer of  at least the size bufSize and executes the  action io whenever the  buffer is full.  Compared to 8) this function requires less allocation, A as the output buffer is only allocated once at the start of the N serialization and whenever something bigger than the current buffer size has I to be copied into the buffer, which should happen very seldomly for the N default buffer size of 32kb. Hence, the pressure on the garbage collector is K reduced, which can be an advantage when building long sequences of bytes. <Run the builder with a 3d buffer and execute the given  5 action whenever the buffer is full or gets flushed.   < = ; 3 This is a Monoid& homomorphism in the following sense. 0 toByteStringIO io mempty == return () Q toByteStringIO io (x `mappend` y) == toByteStringIO io x >> toByteStringIO io y 3456785Buffer size (upper-bounds the resulting chunk size). 1Minimal free buffer space for continuing filling  the same buffer after a 7 or a direct bytestring 4 insertion. This corresponds to the minimal desired  chunk size. 3Size of the first buffer to be used and copied for  larger resulting sequences Builder to run. /Lazy bytestring to output after the builder is  finished. Resulting lazy bytestring 9:;Buffer size (upper bounds  the number of bytes forced  per call to the  action).  action to execute per  full buffer, which is  referenced by a strict  .  to run.  Resulting  action. <$  !"#3456789:;<  798:<;5436 3456789:;<tested on GHC only experimental Simon Meier <iridcode@gmail.com>None=5Write a UTF-8 encoded Unicode character to a buffer. KEncode a Unicode character to another datatype, using UTF-8. This function J acts as an abstract way of encoding characters, as it is unaware of what L needs to happen with the resulting bytes: you have to specify functions to  deal with those. >O(1):. Serialize a Unicode character using the UTF-8 encoding. ?O(n). Serialize a Unicode  using the UTF-8 encoding. @O(n). Serialize a value by (ing it and UTF-8 encoding the resulting  . AO(n). Serialize a strict Unicode ! value using the UTF-8 encoding. 1Note that this function is currently faster than  provided by  Data.Text.Encoding . Moreover, A is also lazy, while    is strict. BO(n). Serialize a lazy Unicode ! value using the UTF-8 encoding. 1Note that this function is currently faster than   provided by  Data.Text.Lazy.Encoding. = 1-byte UTF-8  2-byte UTF-8  3-byte UTF-8  4-byte UTF-8 Input  Result >?@AB=>?@AB=>?@AB=>?@ABtested on GHC only experimental Simon Meier <iridcode@gmail.com>None CWrite a strict  to a buffer. D,Smart serialization of a strict bytestring.  D = E 6DUse this function to serialize strict bytestrings. It guarantees an L average chunk size of 4kb, which has been shown to be a reasonable size in J benchmarks. Note that the check whether to copy or to insert is (almost) 9 free as the builder performance is mostly memory-bound. JIf you statically know that copying or inserting the strict bytestring is . always the best choice, then you can use the F or  G functions. E%fromByteStringWith maximalCopySize bs" serializes the strict bytestring  bs# according to the following rules.   S.length bs <= maximalCopySize: bs! is copied to the output buffer. S.length bs > maximalCopySize: bs" the output buffer is flushed and  bs> is inserted directly as separate chunk in the output stream. IThese rules guarantee that average chunk size in the output stream is at  least half the maximalCopySize. FcopyByteString bs! serialize the strict bytestring bs by copying it to  the output buffer. LUse this function to serialize strict bytestrings that are statically known  to be smallish (<= 4kb). GinsertByteString bs" serializes the strict bytestring bs by inserting / it directly as a chunk of the output stream. LNote that this implies flushing the output buffer; even if it contains just E a single byte. Hence, you should use this operation only for large (> 8kb) M bytestrings, as otherwise the resulting output stream may be too fragmented  to be processed efficiently. HO(n),. Smart serialization of a lazy bytestring.  H = I 6JUse this function to serialize lazy bytestrings. It guarantees an average D chunk size of 4kb, which has been shown to be a reasonable size in J benchmarks. Note that the check whether to copy or to insert is (almost) 9 free as the builder performance is mostly memory-bound. 1If you statically know that copying or inserting all chunks of the lazy < bytestring is always the best choice, then you can use the  J or K functions. IO(n)E. Serialize a lazy bytestring chunk-wise according to the same rules  as in E. Semantically, it holds that  & fromLazyByteStringWith maxCopySize ? = mconcat . map (fromByteStringWith maxCopySize) . L.toChunks DHowever, the left-hand-side is much more efficient, as it moves the L end-of-buffer pointer out of the inner loop and provides the compiler with  more strictness information. JO(n)). Serialize a lazy bytestring by copying all chunks sequentially  to the output buffer. See F for usage considerations. KO(n)+. Serialize a lazy bytestring by inserting all its chunks directly  into the output stream. See G for usage considerations.  For library developers, see the  ModifyChunks build signal, if you  need an O(1)3 lazy bytestring insert based on difference lists. CDE!Maximal number of bytes to copy. Strict  to serialize.  Resulting . FGHI!Maximal number of bytes to copy. Lazy  to serialize.  Resulting . JK CDEFGHIJK CDEFGHIJK CDEFGHIJKtested on GHC only experimental Simon Meier <iridcode@gmail.com>None!LWrite a single byte. MWrite a  in big endian format. NWrite a  in little endian format. OWrite a  in big endian format. PWrite a  in little endian format. QWrite a  in big endian format. RWrite a  in little endian format. SWrite a single native machine . The  is written in host order, & host endian form, for the machine you're on. On a 64 bit machine the  K is an 8 byte value, on a 32 bit machine, 4 bytes. Values written this way F are not portable to different endian or word sized machines, without  conversion. TWrite a + in native host order and host endianness. UWrite a + in native host order and host endianness. VWrite a + in native host order and host endianness. WSerialize a single byte. XSerialize a list of bytes. Y Serialize a  in big endian format. ZSerialize a list of s in big endian format. [ Serialize a  in little endian format. \Serialize a list of s in little endian format. ] Serialize a  in big endian format. ^Serialize a list of s in big endian format. _ Serialize a  in little endian format. `Serialize a list of s in little endian format. a Serialize a  in big endian format. bSerialize a list of s in big endian format. c Serialize a  in little endian format. dSerialize a list of s in little endian format. e"Serialize a single native machine . The  is serialized in host - order, host endian form, for the machine you're on. On a 64 bit machine the  G is an 8 byte value, on a 32 bit machine, 4 bytes. Values written this J way are not portable to different endian or word sized machines, without  conversion. fSerialize a list of s.  See e for usage considerations. gWrite a + in native host order and host endianness. hWrite a list of ,s in native host order and host endianness. iWrite a + in native host order and host endianness. jWrite a list of ,s in native host order and host endianness. kWrite a + in native host order and host endianness. lWrite a list of ,s in native host order and host endianness. !LMNOPQRSTUVWXYZ[\]^_`abcdefghijkl!LMNOPQRSTUVWXYZ[\]^_`abcdefghijkl!LMOQNPRSTUVWXY]a^Zb[_c\`degikfhjl!LMNOPQRSTUVWXYZ[\]^_`abcdefghijkltested on GHC only experimental Simon Meier <iridcode@gmail.com>Nonem3Write the lower 8-bits of a character to a buffer. nO(1)-. Serialize the lower 8-bits of a character. oO(n);. Serialize the lower 8-bits of all characters of a string pO(n). Serialize a value by (ing it and serializing the lower 8-bits  of the resulting string. qO(n)C. Serialize the lower 8-bits of all characters in the strict text. rO(n)A. Serialize the lower 8-bits of all characters in the lazy text. mnopqrmnopqrmnopqrmnopqr NoneWrite a CRLF sequence. Execute a write 6Length of the hex-string required to encode the given . sFTransform a builder such that it uses chunked HTTP transfer encoding. tThe zero-length chunk  '0\r\n\r\n'1 signaling the termination of the data transfer. stststst tested on GHC only experimental Simon Meier <iridcode@gmail.com>None!uWrite a single signed byte. v Write an  in big endian format. w Write an  in little endian format. x Write an  in big endian format. y Write an  in little endian format. z Write an  in big endian format. { Write an  in little endian format. |Write a single native machine . The  is written in host order, & host endian form, for the machine you're on. On a 64 bit machine the  K is an 8 byte value, on a 32 bit machine, 4 bytes. Values written this way I are not portable to different endian or integer sized machines, without  conversion. } Write an + in native host order and host endianness. ~ Write an + in native host order and host endianness.  Write an + in native host order and host endianness. Serialize a single byte. Serialize a list of bytes.  Serialize an  in big endian format. Serialize a list of s in big endian format.  Serialize an  in little endian format. Serialize a list of s in little endian format.  Serialize an  in big endian format. Serialize a list of s in big endian format.  Serialize an  in little endian format. Serialize a list of s in little endian format.  Serialize an  in big endian format. Serialize a list of s in big endian format.  Serialize an  in little endian format. Serialize a list of s in little endian format. "Serialize a single native machine . The  is serialized in host - order, host endian form, for the machine you're on. On a 64 bit machine the  G is an 8 byte value, on a 32 bit machine, 4 bytes. Values written this M way are not portable to different endian or integer sized machines, without  conversion. Serialize a list of s.  See  for usage considerations.  Write an + in native host order and host endianness. Write a list of ,s in native host order and host endianness.  Write an + in native host order and host endianness. Write a list of ,s in native host order and host endianness.  Write an + in native host order and host endianness. Write a list of ,s in native host order and host endianness. !uvwxyz{|}~!uvwxyz{|}~!uvxzwy{|}~!uvwxyz{|}~tested on GHC only experimental Simon Meier <iridcode@gmail.com>NoneY !"#789:;<CDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijkluvwxyz{|}~798:<; !"# tested on GHC only experimental Simon Meier <iridcode@gmail.com>NoneGWrite a HTML escaped and UTF-8 encoded Unicode character to a bufffer. O(1).< Serialize a HTML escaped Unicode character using the UTF-8  encoding. O(n)#. Serialize a HTML escaped Unicode  using the UTF-8  encoding. O(n). Serialize a value by #ing it and then, HTML escaping and  UTF-8 encoding the resulting . O(n)*. Serialize a HTML escaped strict Unicode  value using the  UTF-8 encoding. O(n)#. Serialize a HTML escaped Unicode  using the UTF-8 encoding.  =>?@AB !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwIJKLMN x y z { | } ~  #$1  blaze-builder-0.2.1.4'Blaze.ByteString.Builder.Internal.Types'Blaze.ByteString.Builder.Internal.Write(Blaze.ByteString.Builder.Internal.Buffer!Blaze.ByteString.Builder.Internal"Blaze.ByteString.Builder.Char.Utf8#Blaze.ByteString.Builder.ByteStringBlaze.ByteString.Builder.WordBlaze.ByteString.Builder.Char8Blaze.ByteString.Builder.HTTPBlaze.ByteString.Builder.Int"Blaze.ByteString.Builder.Html.Utf81Blaze.ByteString.Builder.Internal.UncheckedShiftsTL encodeUtf8Blaze.ByteString.BuilderPutunPutBuilder unBuilder BuildStep runBuildStep BuildSignalInsertByteString BufferFullDoneBufRangedone bufferFullinsertByteString buildStepputBuildStepContfromBuildStepCont putBuilderfromPutWriteWriteIO runWriteIOrunWritewriteN exactWrite boundedWrite fromWritefromWriteSingleton fromWriteList writeStorable fromStorable fromStorablesBufferAllocStrategyBufferfreeSize sliceSize bufferSize allocBuffer reuseBufferunsafeFreezeBufferunsafeFreezeNonEmptyBufferupdateEndOfSlice execBuildStep nextSliceallNewBuffersStrategyreuseBufferStrategyrunPutdefaultBufferSizedefaultMinimalBufferSizedefaultFirstBufferSizedefaultMaximalCopySizeflushtoLazyByteStringWithtoLazyByteString toByteStringtoByteStringIOWithtoByteStringIO writeCharfromChar fromStringfromShowfromText fromLazyTextwriteByteStringfromByteStringfromByteStringWithcopyByteStringfromLazyByteStringfromLazyByteStringWithcopyLazyByteStringinsertLazyByteString writeWord8 writeWord16be writeWord16le writeWord32be writeWord32le writeWord64be writeWord64le writeWordhostwriteWord16hostwriteWord32hostwriteWord64host fromWord8 fromWord8s fromWord16be fromWord16sbe fromWord16le fromWord16sle fromWord32be fromWord32sbe fromWord32le fromWord32sle fromWord64be fromWord64sbe fromWord64le fromWord64sle fromWordhost fromWordshostfromWord16hostfromWord16shostfromWord32hostfromWord32shostfromWord64hostfromWord64shostchunkedTransferEncodingchunkedTransferTerminator writeInt8 writeInt16be writeInt16le writeInt32be writeInt32le writeInt64be writeInt64le writeInthostwriteInt16hostwriteInt32hostwriteInt64hostfromInt8 fromInt8s fromInt16be fromInt16sbe fromInt16le fromInt16sle fromInt32be fromInt32sbe fromInt32le fromInt32sle fromInt64be fromInt64sbe fromInt64le fromInt64sle fromInthost fromIntshost fromInt16hostfromInt16shost fromInt32hostfromInt32shost fromInt64hostfromInt64shostwriteHtmlEscapedCharfromHtmlEscapedCharfromHtmlEscapedStringfromHtmlEscapedShowfromHtmlEscapedTextfromHtmlEscapedLazyText $fMonadPut $fFunctorPut$fMonoidBuilder $fMonoidWrite$fMonoidWriteIO shiftr_w16 shiftr_w32 shiftr_w64 nonEmptyChunkbytestring-0.9.2.1Data.ByteString.Lazy.Internal ByteString packChunksghc-prim GHC.TypesIOData.ByteString.InternalencodeCharUtf8baseGHC.BaseStringGHC.ShowShow text-0.11.3.1Data.Text.InternalTextData.Text.Lazy.EncodingData.Text.Lazy.InternalCharcopyByteStringStepGHC.WordWord16Word32Word64Word writeCRLF execWriteword32HexLengthpokeWord32HexNiterationsUntilZerowriteWord32HexGHC.IntInt16Int32Int64Int