σh      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefg portable to Hugs and GHC experimental%Lennart Kolmodin <kolmodin@gmail.com> TrustworthyA # is an efficient way to build lazy hs. . There are several functions for constructing s, but only one G to inspect them: to extract any data, you have to turn them into lazy  hs using . Internally, a  constructs a lazy   by filling byte 9 arrays piece by piece. As each buffer is filled, it is 'popped' 2 off, to become a new chunk of the resulting lazy h. ) All this is hidden from the user of the . O(1). The empty Builder, satisfying    = iO(1)., A Builder taking a single byte, satisfying   ( b) = j bO(1).= The concatenation of two Builders, an associative operation  with identity  , satisfying   ( x y) = k ( x) ( y)O(1). A Builder taking a l , satisfying   ( bs) = m [bs]O(1). A Builder taking a lazy h , satisfying   ( bs) = bsO(n). Extract a lazy h from a . D The construction work takes place if and when the relevant part of  the lazy h is demanded. O(1). Pop the l% we have constructed so far, if any, ) yielding a new chunk in the result lazy h. n'Sequence an IO operation on the buffer oGet the size of the buffer p'Map the resulting list of bytestrings. qEnsure that there are at least n many bytes available.  Ensure that n# bytes are available, and then use f to write at  most n bytes into memory. f" must return the actual number of  bytes written.  Ensure that n# bytes are available, and then use f to write  exactly n bytes into memory. $Write a Word16 in big endian format 'Write a Word16 in little endian format $Write a Word32 in big endian format 'Write a Word32 in little endian format $Write a Word64 in big endian format 'Write a Word64 in little endian format O(1).< A Builder taking a single native machine word. The word is = written in host order, host endian form, for the machine you're on. G On a 64 bit machine the Word is an 8 byte value, on a 32 bit machine, 6 4 bytes. Values written this way are not portable to > different endian or word sized machines, without conversion. 9Write a Word16 in native host order and host endianness. % 2 bytes will be written, unaligned. 9Write a Word32 in native host order and host endianness. % 4 bytes will be written, unaligned. %Write a Word64 in native host order. J On a 32 bit machine we write two host order Word32s, in big endian form. % 8 bytes will be written, unaligned. (Write a character using UTF-8 encoding. 'rstuvnopq wx yz{|}~ $rstuvnopq wx yz{|}~portable to Hugs and GHC experimental%Lennart Kolmodin <kolmodin@gmail.com> Trustworthy  None A decoder produced by running a  monad. =The decoder needs to know the current position in the input. > Given the number of bytes remaning in the decoder, the outer 4 decoder runner needs to calculate the position and  resume the decoding. 6The decoder has successfully finished. Except for the - output value you also get the unused input. 7The decoder has consumed the available input and needs  more to continue. Provide  if more input is available  and # otherwise, and you will get a new . 7The decoder ran into an error. The decoder either used  # or was not provided enough input. Run a  monad. See % for what to do next, like providing > input, handling decoding errors and to get the output value. Make sure we don'+t have to pass Nothing to a Partial twice.  This way we don'8t need to pass around an EOF value in the Get monad, it . can safely ask several times if it needs to. 2Get the total number of bytes read to this point. ,Demand more input. If none available, fail.  Skip ahead n bytes. Fails if fewer than n bytes are available. FTest whether all input has been consumed, i.e. there are no remaining  undecoded bytes. !DEPRECATED. Same as &. ;Run a decoder and keep track of all the input it consumes.  Once it'-s finished, return the final decoder (always  or ), > and unconsume all the the input the decoder required to run. = Any additional chunks which was required to run the decoder  will also be returned. "ERun the given decoder, but without consuming its input. If the given , decoder fails, then so will this function. #@Run the given decoder, and only consume its input if it returns .  If , is returned, the input will be unconsumed. 9 If the given decoder fails, then so will this function. $@Run the given decoder, and only consume its input if it returns .  If , is returned, the input will be unconsumed. 9 If the given decoder fails, then so will this function. %8DEPRECATED. Get the number of bytes of remaining input. M Note that this is an expensive function to use as in order to calculate how B much input remains, all input has to be read and kept in-memory. N The decoder keeps the input as a strict bytestring, so you are likely better 8 off by calculating the remaining input in another way. &DAn efficient get method for strict ByteStrings. Fails if fewer than n ! bytes are left in the input. If n <= 0$ then the empty string is returned. 'Get the current chunk. (Replace the current chunk. )Return at least n4 bytes, maybe more. If not enough data is available " the computation will escape with . *Ensure that there are at least n bytes available. If not, the  computation will escape with . * !"#$%&'()*+ !"#$%&'()*+)+'(*%! "#$&$ !"#$%&'()*+portable to Hugs and GHC experimental%Lennart Kolmodin <kolmodin@gmail.com>Safe   portable to Hugs and GHC. experimental%Lennart Kolmodin <kolmodin@gmail.com> Trustworthy,An offset, counted in bytes. - A decoder procuced by running a  monad. .6The decoder has successfully finished. Except for the ; output value you also get any unused input as well as the  number of bytes consumed. /7The decoder has consumed the available input and needs  more to continue. Provide  if more input is available  and # otherwise, and you will get a new -. 07The decoder ran into an error. The decoder either used  0 or was not provided enough input. Contains any 4 unconsumed input and the number of bytes consumed. 1Run a  monad. See -% for what to do next, like providing = input, handling decoder errors and to get the output value.  Hint: Use the helper functions 5, 6 and  7. 2KDEPRECATED. Provides compatibility with previous versions of this library.  Run a , monad and return a tuple with thee values. L The first value is the result of the decoder. The second and third are the 1 unused input, and the number of consumed bytes. 3Run a  monad and return  on failure and  on E success. In both cases any unconsumed input and the number of bytes @ consumed is returned. In the case of failure, a human-readable $ error message is included as well. 4 The simplest interface to run a # decoder. If the decoder runs into  an error, calls %, or runs out of input, it will call . 5Feed a - with more input. If the - is . or 0 it  will add the input to l of unconsumed input.   1 myParser ` pushChunk` myInput1 ` pushChunk` myInput2 6Feed a - with more input. If the - is . or 0 it  will add the input to  ByteString of unconsumed input.   1 myParser ` pushChunks` myLazyByteString 7Tell a -* that there is no more input. This passes  to a  /3 decoder, otherwise returns the decoder unchanged. 8BAn efficient get method for lazy ByteStrings. Fails if fewer than n  bytes are left in the input. 9:Get a lazy ByteString that is terminated with a NUL byte. : The returned string does not contain the NUL byte. Fails 7 if it reaches the end of input without finding a NUL. :.Get the remaining bytes as a lazy ByteString. I Note that this can be an expensive function to use as it forces reading - all input and keeping the string in-memory. ;"Read a Word8 from the monad state <#Read a Word16 in big endian format =&Read a Word16 in little endian format >#Read a Word32 in big endian format ?&Read a Word32 in little endian format @#Read a Word64 in big endian format A&Read a Word64 in little endian format BO(1).8 Read a single native machine word. The word is read in 2 host order, host endian form, for the machine you're on. On a 64 bit D machine the Word is an 8 byte value, on a 32 bit machine, 4 bytes. CO(1).@ Read a 2 byte Word16 in native host order and host endianness. DO(1).9 Read a Word32 in native host order and host endianness. EO(1).8 Read a Word64 in native host order and host endianess. ',-./0123456789:;<=>?@ABCDE$ !"#$%&,-./0123456789:;<=>?@ABCDE$43,-0/.1567 "#$&89:;<>@=?ABCDE2%!$,-0/.123456789:;<=>?@ABCDE(Portable to Hugs and GHC. Requires MPTCsstable%Lennart Kolmodin <kolmodin@gmail.com> TrustworthyF=Put merely lifts Builder into a Writer monad, applied to (). GAThe PutM type. A Writer monad over the efficient Builder monoid. KRun the F monad LRun the F monad with a serialiser MRun the F, monad with a serialiser and get its result NBPop the ByteString we have constructed so far, if any, yielding a % new chunk in the result ByteString. O0Efficiently write a byte into the output buffer PLAn efficient primitive to write a strict ByteString into the output buffer. J It flushes the current buffer, and writes the argument into a new chunk. Q?Write a lazy ByteString efficiently, simply appending the lazy ( ByteString chunks to the output buffer R$Write a Word16 in big endian format S'Write a Word16 in little endian format T$Write a Word32 in big endian format U'Write a Word32 in little endian format V$Write a Word64 in big endian format W'Write a Word64 in little endian format XO(1).1 Write a single native machine word. The word is = written in host order, host endian form, for the machine you're on. G On a 64 bit machine the Word is an 8 byte value, on a 32 bit machine, 6 4 bytes. Values written this way are not portable to > different endian or word sized machines, without conversion. YO(1).: Write a Word16 in native host order and host endianness.  For portability issues see  putWordhost. ZO(1).: Write a Word32 in native host order and host endianness.  For portability issues see  putWordhost. [O(1).% Write a Word64 in native host order J On a 32 bit machine we write two host order Word32s, in big endian form.  For portability issues see  putWordhost. FGHIJKLMNOPQRSTUVWXYZ[FGHIJKLMNOPQRSTUVWXYZ[FGHILMJKNOPQRTVSUWXYZ[FGHIJKLMNOPQRSTUVWXYZ[ Fportable to Hugs and GHC. Requires the FFI and some flexible instancesunstable%Lennart Kolmodin <kolmodin@gmail.com> Trustworthy\The \ class provides ] and ^, methods to encode and " decode a Haskell value to a lazy h. It mirrors the  and  = classes for textual representation of Haskell types, and is D suitable for serialising Haskell values to disk, over the network. CFor decoding and generating simple external binary formats (e.g. C A structures), Binary may be used, but in general is not suitable ( for complex protocols. Instead use the F and  primitives  directly. ;Instances of Binary should satisfy the following property:   decode . encode == id  That is, the ^ and ]' methods should be the inverse of each C other. A range of instances are provided for basic Haskell types. ]!Encode a value in the Put monad. ^ Decode a value in the Get monad ' getMany n' get n/ elements in order, without blowing the stack. 2\]^_`a\]^_`a.\]^_`a !Only works with GHC 7.2 and newerunstable%Bryan O'Sullivan <bos@serpentine.com> TrustworthyGportable to Hugs and GHC. Requires the FFI and some flexible instances.unstable%Lennart Kolmodin <kolmodin@gmail.com> Trustworthyb@Encode a value using binary serialisation to a lazy ByteString. cNDecode a value from a lazy ByteString, reconstructing the original structure. d1Decode a value from a lazy ByteString. Returning  on failure and  B on success. In both cases the unconsumed input and the number of H consumed bytes is returned. In case of failure, a human-readable error # message will be returned as well. e$Lazily serialise a value to a file. 'This is just a convenience function, it's defined simply as:  ' encodeFile f = B.writeFile f . encode ASo for example if you wanted to compress as well, you could use: # B.writeFile f . compress . encode f/Decode a value from a file. In case of errors,  will # be called with the error message. gKDecode a value from a file. In case of success, the value will be returned  in =. In case of decoder errors, the error message together with # the byte offset will be returned. bcdefg;FO\]^_`abcdefg\]^_`aFO;bcdefgbcdefg   !"#$%&'()*+,-./012345678#%&'(9:;<=>?@ABCDEFGHIJKLMNMOPQRSTUV W 4 3 X Y Z[\]^_`abcad adadaecadfghijkk lmnopqrstuvwxywxzw{|}~wwwww      wwwwbinary-0.7.1.0Data.Binary.BuilderData.Binary.Builder.InternalData.Binary.Get.InternalData.Binary.GetData.Binary.Put Data.BinaryData.Binary.Builder.BaseL BytestringData.Binary.ClassData.Binary.GenericBuilderempty singletonappendfromByteStringfromLazyByteStringtoLazyByteStringflush writeAtMostwriteN putWord16be putWord16le putWord32be putWord32le putWord64be putWord64le putWordhost putWord16host putWord32host putWord64host putCharUtf8GetrunContDecoder BytesReadDonePartialFailrunGetIncremental bytesRead demandInputskipisEmptygetBytes lookAhead lookAheadM lookAheadE remaining getByteStringgetputreadNensureN readNWith ByteOffset runGetState runGetOrFailrunGet pushChunk pushChunkspushEndOfInputgetLazyByteStringgetLazyByteStringNulgetRemainingLazyByteStringgetWord8 getWord16be getWord16le getWord32be getWord32le getWord64be getWord64le getWordhost getWord16host getWord32host getWord64hostPutPutMunPut putBuilderexecPutrunPutrunPutMputWord8 putByteStringputLazyByteStringBinaryGBinarygputggetencodedecode decodeOrFail encodeFile decodeFiledecodeFileOrFailbytestring-0.10.0.2Data.ByteString.Lazy.Internal ByteStringData.ByteString.LazyData.ByteString.Internal fromChunks withBufferwithSize mapBuilder ensureFreeBuffer runBuilder defaultSize writeBuffer newBufferord2ord3ord4 shiftr_w16 shiftr_w32 shiftr_w64$fMonoidBuilderbase Data.MaybeJustNothingGHC.Basefail noMeansNorunAndKeepTrack Data.EitherRightLeftSuccessCreturnGbindGfailGapGfmapGpromptpushBack unsafeReadN$fAlternativeGet $fShowDecoder$fFunctorDecoder $fFunctorGet$fMonadPlusGet$fApplicativeGet $fMonadGetGHC.ErrerrorcalculateOffset takeHeadChunk dropHeadChunkgetPtrword16beword16leword32beword32leword64beword64le shiftl_w16 shiftl_w32 shiftl_w64PairSsndStell $fMonadPutM$fApplicativePutM $fFunctorPutMGHC.ReadReadGHC.ShowShowgetManySmallIntunrollroll$fBinaryUArray $fBinaryArray $fBinaryTree $fBinaryFloat$fBinaryDouble $fBinarySeq$fBinaryIntMap$fBinaryIntSet $fBinaryMap $fBinarySet$fBinaryByteString$fBinaryByteString0$fBinaryEither $fBinaryMaybe $fBinary[]$fBinary(,,,,,,,,,)$fBinary(,,,,,,,,)$fBinary(,,,,,,,)$fBinary(,,,,,,)$fBinary(,,,,,)$fBinary(,,,,) $fBinary(,,,) $fBinary(,,) $fBinary(,) $fBinaryChar $fBinaryRatio$fBinaryInteger $fBinaryInt $fBinaryWord $fBinaryInt64 $fBinaryInt32 $fBinaryInt16 $fBinaryInt8$fBinaryWord64$fBinaryWord32$fBinaryWord16 $fBinaryWord8$fBinaryOrdering $fBinaryBool $fBinary()TaggedunTaggedSumSizesumSizeGSumgetSumputSum sizeError checkGetSum $fSumSizeM1 $fSumSize:+:$fGSumM1 $fGSum:+: $fGBinary:+: $fGBinaryK1 $fGBinaryM1 $fGBinary:*: $fGBinaryU1 $fGBinaryV1ghc-prim GHC.TypesWordGHC.WordWord8Word16Word32Word64