&xS      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRBSD3 experimental type-families Safe-Inferred3=KSTUVWXYZ[\]^_`abcdefghSTUVWXYZ[\]^_`abcdefghBSD3 experimental+type-families, generalized newtype derivingNone3=BKijij(c) Edward Kmett 2013BSD3Edward Kmett <ekmett@gmail.com> experimental non-portable Trustworthy 136=JK/Efficiently write a byte into the output buffer )An efficient primitive to write a strict k into the output buffer.In binaryK this flushes the current buffer, and writes the argument into a new chunk.  Write a lazy l efficiently.With binary5, this simply appends the chunks to the output buffer Pop the kI we have constructed so far, if any, yielding a new chunk in the result k.If we're building a strict k with cereal then this does nothing. Write a m in little endian format Write a m in big endian formatO(1). Write a mG in native host order and host endianness. For portability issues see .Write a n in little endian formatWrite a n in big endian formatO(1). Write a nG in native host order and host endianness. For portability issues see  putWordhost.Write a o in little endian formatWrite a o in big endian formatO(1). Write a oG in native host order and host endianness. For portability issues see  putWordhost.O(1).0 Write a single native machine word. The word is written in host order, host endian form, for the machine you're on. On a 64 bit machine the Word is an 8 byte value, on a 32 bit machine, 4 bytes. Values written this way are not portable to different endian or word sized machines, without conversion.Put a value into a lazy l using p.Put a value into a strict k using q. rstuvwxyz{    rstuvwxyz{(c) Edward Kmett 2013BSD3Edward Kmett <ekmett@gmail.com> experimental type-families Trustworthy13=KAn |3 number type used for unchecked skips and counting.4The underlying ByteString type used by this instance Skip ahead n bytes. Fails if fewer than n bytes are available. If at least nU bytes are available return at least that much of the current input. Otherwise fail.Run ga4, but return without consuming its input. Fails if ga fails.Like , but consume the input if gma returns 'Just _'. Fails if gma fails.Like , but consume the input if gea returns 'Right _'. Fails if gea fails. Pull n. bytes from the input, as a strict ByteString.!Get the number of remaining unparsed bytes. Useful for checking whether all input has been consumed. Note that this forces the rest of the input."VTest whether all input has been consumed, i.e. there are no remaining unparsed bytes.#!Read a Word8 from the monad state$ An efficient }5 method for strict ByteStrings. Fails if fewer than n bytes are left in the input.% An efficient }; method for lazy ByteStrings. Does not fail if fewer than n bytes are left in the input.&Read a m in big endian format'Read a m in little endian format(O(1). Read a 2 byte m* in native host order and host endianness.)Read a n in big endian format*Read a n in little endian format+O(1). Read a n* in native host order and host endianness.,Read a o in big endian format-Read a o in little endian format.O(1). Read a o) in native host order and host endianess./O(1). Read a single native machine word. The word is read in host order, host endian form, for the machine you're on. On a 64 bit machine the Word is an 8 byte value, on a 32 bit machine, 4 bytes.0Get something from a lazy l using ~.1Get something from a strict k using .$ !"#$%&'()*+,-./01 !"#$%&'()*+,-./01 !"#$%&'()*+,-./01  !"#$%&'()*+,-./01(c) Edward Kmett 2013BSD3Edward Kmett <ekmett@gmail.com> experimental non-portable Trustworthy  136=JKM50Used internally to provide generic serialization;;Used internally to provide generic big-endian serialization@0Used internally to provide generic serializationC*Methods to serialize and deserialize type a to a binary representationInstances provided here for fixed-with Integers and Words are big endian. Instances for strict and lazy bytestrings store also the length of bytestring big endian. Instances for Word and Int are host endian as they are machine-specific types.F*Methods to serialize and deserialize type a to a big and little endian binary representations. Methods suffixed with "host" are automatically defined to use equal the methods corresponding to the current machine's native endianness, but they can be overridden.Mserialize any  in a host-specific format.Ndeserialize any  in a host-specific format.6runGetL deserialize $ runPutL $ serialize LT::OrderingLT6runGetL deserialize $ runPutL $ serialize EQ::OrderingEQ6runGetL deserialize $ runPutL $ serialize GT::OrderingGTfgetModJulianDate $ (runGetL deserialize $ runPutL $ serialize (ModJulianDate $ 5 % 11)::UniversalTime)5 % 11J(runGetL deserialize $ runPutL $ serialize (5 % 11::Ratio Int))::Ratio Int5 % 11Y(runGetL deserialize $ runPutL $ serialize (addAbsoluteTime 18.2 taiEpoch))::AbsoluteTime1858-11-17 00:00:18.2 TAIe(runGetL deserialize $ runPutL $ serialize (read "2014-01-01 10:54:42.478031 UTC"::UTCTime))::UTCTime2014-01-01 10:54:42.478031 UTCF(runGetL deserialize $ runPutL $ serialize (ModifiedJulianDay 1))::Day 1858-11-18F(runGetL deserialize $ runPutL $ serialize (1.82::DiffTime))::DiffTime1.82sF(runGetL deserialize $ runPutL $ serialize (1.82::DiffTime))::DiffTime1.82sF(runGetL deserialize $ runPutL $ serialize (1.82::Fixed E2))::Fixed E21.82N(runGetL deserialize $ runPutL $ serialize (1822304234^100::Integer))::Integer115368812579128172803867366576339947332796540054052185472042218522037227934707037623902492207671987696439966697503243972076991940820348847422930433939639982092916577692754723458548819441583937289395076910527534916776189405228720063994377687015476947534961767053653973945346259230972683338173842343243493433367681264359887291905132383269175086733345253389374961758293922003996035662362278340494093804835649459223465051596978792130073960666112508481814461273829244289795707398202762289955919352549768394583446336873179280924584333491364188425976869717125645749497258775598562132278030402205794994603544837805140410310712693778605743100915046769381631247123664460203591228745772887977959388457679427407639421147498028487544882346912935398848298806021505673449774474457435816552278997100556732447852816961683577731381792363312695347606768120122976105200574809419685234274705929886121600174028733812771637390342332436695318974693376Q$setup >>> import Data.Word >>> import Data.Fixed >>> import Data.Bytes.Serial>Integer/Word types serialized to base-128 variable-width ints.import Data.Monoid (mconcat),import qualified Data.ByteString.Lazy as BSL;mconcat $ BSL.toChunks $ runPutL $ serialize (97 :: Word64)"\NUL\NUL\NUL\NUL\NUL\NUL\NULa"Bmconcat $ BSL.toChunks $ runPutL $ serialize (97 :: VarInt Word64)"a"23456789:;<=>?@ABCDEFGHIJKLMNOPQR!23456789:;<=>?@ABCDEFGHIJKLMNOPQR!CDEFGHIJKL89:OP234QRMN@AB;<=>?567w23456789:;<=>?@ABCDEFGHIJKLMNOPQR       !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrpsrtuvtuwtuxyz{|}{~ty|tbytes-0.14.1.1Data.Bytes.SignedData.Bytes.VarIntData.Bytes.PutData.Bytes.GetData.Bytes.SerialSignedUnsignedunsignedsignedVarIntunVarIntMonadPutputWord8 putByteStringputLazyByteStringflush putWord16le putWord16be putWord16host putWord32le putWord32be putWord32host putWord64le putWord64be putWord64host putWordhostrunPutLrunPutSMonadGet RemainingBytesskipensure lookAhead lookAheadM lookAheadEgetBytes remainingisEmptygetWord8 getByteStringgetLazyByteString getWord16be getWord16le getWord16host getWord32be getWord32le getWord32host getWord64be getWord64le getWord64host getWordhostrunGetLrunGetSSerial2serializeWith2deserializeWith2GSerial1gserializeWithgdeserializeWithSerial1 serializeWithdeserializeWith GSerialEndian gserializeBEgdeserializeBE gserializeLEgdeserializeLEGSerial gserialize gdeserializeSerial serialize deserialize SerialEndian serializeBE deserializeBE serializeLE deserializeLE serializeHostdeserializeHoststorerestore serialize1 deserialize1 serialize2 deserialize2TFCo:R:SignedWord64TFCo:R:SignedWord32TFCo:R:SignedWord16TFCo:R:SignedWord8TFCo:R:SignedWordTFCo:R:SignedIntegerTFCo:R:SignedInt64TFCo:R:SignedInt32TFCo:R:SignedInt16TFCo:R:SignedInt8TFCo:R:SignedIntTFCo:R:UnsignedWord64TFCo:R:UnsignedWord32TFCo:R:UnsignedWord16TFCo:R:UnsignedWord8TFCo:R:UnsignedWordTFCo:R:UnsignedIntegerTFCo:R:UnsignedInt64TFCo:R:UnsignedInt32TFCo:R:UnsignedInt16TFCo:R:UnsignedInt8TFCo:R:UnsignedIntTFCo:R:SignedVarIntTFCo:R:UnsignedVarIntbytestring-0.10.4.0Data.ByteString.Internal ByteStringData.ByteString.Lazy.InternalbaseGHC.WordWord16Word32Word64binary-0.7.1.0Data.Binary.PutrunPutcereal-0.4.1.0Data.Serialize.Put$fMonadPutExceptT$fMonadPutRWST$fMonadPutRWST0$fMonadPutWriterT$fMonadPutWriterT0$fMonadPutReaderT$fMonadPutStateT$fMonadPutStateT0$fMonadPutPutM$fMonadPutPutM0GHC.RealIntegral mtl-2.2.1Control.Monad.State.ClassgetData.Binary.GetrunGetData.Serialize.Get$fMonadGetExceptT$fMonadGetRWST$fMonadGetRWST0$fMonadGetWriterT$fMonadGetWriterT0$fMonadGetReaderT$fMonadGetStateT$fMonadGetStateT0 $fMonadGetGet$fMonadGetGet0Foreign.StorableStorable$fSerialOrdering$fSerialUniversalTime $fSerialRatio$fSerialAbsoluteTime$fSerialUTCTime $fSerialDay$fSerialNominalDiffTime$fSerialDiffTime $fSerialFixed$fSerialInteger$fSerialVarIntword64ToDoubledoubleToWord64 word32ToFloat floatToWord32 putVarInt getVarInt$fSerial2(,,,,)$fSerial2(,,,) $fSerial2(,,) $fSerial2(,)$fSerial2Either $fGSerial1K1 $fGSerial1M1 $fGSerial1:+: $fGSerial1:*: $fGSerial1V1 $fGSerial1U1$fGSerial1Rec1$fGSerial1Par1 $fSerial1Map$fSerial1IntMap $fSerial1Seq$fSerial1(,,,,)$fSerial1(,,,) $fSerial1(,,) $fSerial1(,)$fSerial1Either$fSerial1Maybe $fSerial1[]$fGSerialEndianK1 $fGSerialK1 $fGSerialM1 $fGSerial:+: $fGSerial:*: $fGSerialV1 $fGSerialU1 $fSerialLast $fSerialFirst$fSerialProduct $fSerialSum $fSerialAny $fSerialAll $fSerialDual$fSerialReverse$fSerialProduct0$fSerialConstant$fSerialIdentity$fSerialZipList$fSerialVersion $fSerialDown$fSerialZonedTime$fSerialLocalTime$fSerialTimeOfDay$fSerialTimeZone $fSerialMap$fSerialIntMap $fSerialSet $fSerialSeq$fSerialIntSet $fSerialVoid $fSerialInt8 $fSerialInt16 $fSerialInt32 $fSerialInt64 $fSerialInt $fSerialWord8$fSerialWord16$fSerialWord32$fSerialWord64 $fSerialWord $fSerialChar $fSerialFloat$fSerialDouble $fSerialBool$fSerial(,,,,) $fSerial(,,,) $fSerial(,,) $fSerial(,)$fSerialEither $fSerialMaybe $fSerial[] $fSerial() $fSerialText $fSerialText0$fSerialByteString$fSerialByteString0$fSerialEndianInt16$fSerialEndianInt32$fSerialEndianInt64$fSerialEndianWord16$fSerialEndianWord32$fSerialEndianWord64$fSerialEndianChar$fSerialEndianFloat$fSerialEndianDouble