T      !"#$%&'()*+,-./01234 5 6 7 89:;<=>?@ABCDEFGHIJKLMNOPQRSTU V W X Y Z [ \ ] ^ _ ` a b c d e f g h i j k l m n o pqrstuv w x y z { | } ~   (c) Vincent Hanquez 2014 BSD-styleVincent Hanquez provisionalnon-portable (requires POSIX)NoneMemory synchronization flagsinvalidate cache data.perform synchronous write.perform asynchronous write.Advice to put on memory.only define the posix one.(Do not expect access in the near future.IExpect access in the near future. Probably a good idea to readahead earlyRExpect page references in sequential order. Page should be readahead aggressively.BExpect page references in random order. No readahead should occur. no specific advice, the default.Memory protection Mapping flag%memory changes are private to process)memory changes are shared between processMap pages of memory.vIf fd is present, this memory will represent the file associated. Otherwise, the memory will be an anonymous mapping.use mmapUnmap pages of memoryuse munmap7give advice to the operating system about use of memorycall madvise%lock a range of process address spacecall mlock'unlock a range of process address spacecall munlock set protection of memory mappingcall mprotect4memorySync synchronize memory with physical storage.EOn an anonymous mapping this function doesn't have any effect. call msync&Return the operating system page size.call sysconf$*The address to map to if MapFixed is used.The length of the mapping1the memory protection associated with the mapping BSD-style#Vincent Hanquez <vincent@snarc.org> experimentalunknown Safe-Inferred BSD-style#Vincent Hanquez <vincent@snarc.org>stableCompatNone; BSD-style#Vincent Hanquez <vincent@snarc.org>stableCompatNone;$byteswap Word# to or from Big Endian0on a big endian machine, this function is a nop.'byteswap Word# to or from Little Endian3on a little endian machine, this function is a nop.VSimple compatibility for byteswap the lower 32 bits of a Word# at the primitive levelpSimple wrapper to handle pre 7.8 and future, where most comparaison functions don't returns a boolean anymore.=Apply or or another function if 8 divides the number of bytesnumber of bytes?if it divided by 8, the argument is the number of 8 bytes words'if it doesn't, just the number of bytes BSD-style#Vincent Hanquez <vincent@snarc.org>stableCompatNone; BSD-style#Vincent Hanquez <vincent@snarc.org> experimentalunknown Safe-Inferred.A simple Extended Word128 composed of 2 Word64 BSD-style#Vincent Hanquez <vincent@snarc.org> experimentalunknown Safe-Inferred, BSD-style#Vincent Hanquez <vincent@snarc.org> experimentalunknown Safe-Inferred;Create a new temporary buffer1xor bytes from source1 and source2 to destination d = s1 xor s22s1, nor s2 are modified unless d point to s1 or s2:xor bytes from source with a specific value to destinationd = replicate (sizeof s) v  s Copy a set number of bytes from src to dstSet $n number of bytes to the same value v'Check if two piece of memory are equals8Compare two piece of memory and returns how they compare 2A constant time equality test for 2 Memory bufferscompared to normal equality function, this function will go over all the bytes present before yielding a result even when knowing the overall result early in the processing.       BSD-style#Vincent Hanquez <vincent@snarc.org>stableGoodNoneperform io for hashes that do allocation and ffi. unsafeDupablePerformIO is used when possible as the computation is pure and the output is directly linked to the input. we also do not modify anything after it has been returned to the user. BSD-style#Vincent Hanquez <vincent@snarc.org> experimentalunknownNone;HM )Transform a raw memory to an hexadecimal user beware, no checks are made 'Transform a number of bytes pointed by.0src in the hexadecimal binary representation in dst\destination memory need to be of correct size, otherwise it will lead to really bad things.Convert a value Word to two Word9s containing the hexadecimal representation of the Word# convert a base16 src in dst.n need to even a with1 type of function to hold reference to the objectlength in bytes destination memory source memorynumber of bytes     BSD-style&Nicolas DI PRIMA <nicolas@di-prima.fr> experimentalunknownNone;HM 'Transform a number of bytes pointed by.+src in the base32 binary representation in dst\destination memory need to be of correct size, otherwise it will lead to really bad things.GGet the length needed for the destination buffer for a base32 decoding.9if the length is not a multiple of 8, Nothing is returnedconvert from base32 in src to binary in (dst, using the number of bytes specifiedthe user should use unBase32Length to compute the correct length, or check that the length specification is proper. no check is done here. inputoutput input len    BSD-style#Vincent Hanquez <vincent@snarc.org> experimentalunknownNone;HM'Transform a number of bytes pointed by.+src in the base64 binary representation in dst\destination memory need to be of correct size, otherwise it will lead to really bad things.GGet the length needed for the destination buffer for a base64 decoding.9if the length is not a multiple of 4, Nothing is returnedconvert from base64 in src to binary in (dst, using the number of bytes specifiedthe user should use unBase64Length to compute the correct length, or check that the length specification is proper. no check is done here. BSD-style#Vincent Hanquez <vincent@snarc.org>stablegoodNoneB (Class of types that can be byte-swapped.e.g. Word16, Word32, Word64Big Endian valueLittle Endian valuerepresent the CPU endiannessBig endian system stores bytes with the MSB as the first byte. Little endian system stores bytes with the LSB as the first byte.#middle endian is purposely avoided.Return the system endianness.Convert a value in cpu endianess to big endian5Convert from a big endian value to the cpu endianness 1Convert a value in cpu endianess to little endian!8Convert from a little endian value to the cpu endianness ! !!   ! BSD-style#Vincent Hanquez <vincent@snarc.org> experimentalgoodNone"Siphash tag value$ SigHash Key;produce a siphash with a key and a memory pointer + length.same as U, except also specifies the number of sipround iterations for compression and digest.  "#$% siphash C siphash Dkey for the hashmemory pointerlength of the data"#$%  "#$% BSD-style#Vincent Hanquez <vincent@snarc.org> experimentalgoodNone;B&FNV1(a) hash (64 bit variants)(FNV1(a) hash (32 bit variants) 6compute FNV1 (32 bit variant) of a raw piece of memory 7compute FNV1a (32 bit variant) of a raw piece of memory 6compute FNV1 (64 bit variant) of a raw piece of memory7compute FNV1a (64 bit variant) of a raw piece of memory&'()   &'()   &'()    BSD-style#Vincent Hanquez <vincent@snarc.org>stableGoodNone*0Class to allocate new ByteArray of specific size,7Class to Access size properties and data of a ByteArray-)Return the length in bytes of a bytearray.Allow to use using a pointer*+,-.*+,-.*+,-. BSD-style#Vincent Hanquez <vincent@snarc.org>stableGoodNone;/Simplest Byte Array/ !"#$%// !"#$% BSD-style#Vincent Hanquez <vincent@snarc.org>StableGHCNone;0=ScrubbedBytes is a memory chunk which have the properties of:+Being scrubbed after its goes out of scope.6A Show instance that doesn't actually show any content#A Eq instance that is constant time0&'()*+,-./0123456700&'()*+,-./01234567 BSD-style#Vincent Hanquez <vincent@snarc.org>stableGoodNone1*A simple abstraction to a piece of memory.fDo beware that garbage collection related to piece of memory could be triggered before this is used.XOnly use with the appropriate handler has been used (e.g. withForeignPtr on ForeignPtr)3>Increase the memory view while reducing the size of the windowkthis is useful as an abtraction to represent the current offset in a buffer, and the remaining bytes left.12381231238 BSD-StyleNone4Simple ByteArray Packer5Packing result:=PackerMore: the next state of Packing with an arbitrary valuePackerFail: an error happened9run a sized action:run a sized action4;<567=>?@9:ABC4;<5679: 4;<576=>?@9:ABC BSD-style#Vincent Hanquez <vincent@snarc.org>stableGoodNone8QAllocate a new bytearray of specific size, and run the initializer on this memory9QAllocate a new bytearray of specific size, and run the initializer on this memory: similar to 8: but hide the allocation and initializer in a pure context; similar to 9: but hide the allocation and initializer in a pure context<Create an empty byte array=Check if a byte array is empty>%Pack a list of bytes into a bytearray?(Un-pack a bytearray into a list of bytes@Preturns the first byte, and the remaining bytearray if the bytearray is not nullA&Create a xor of bytes between a and b.9the returns byte array is the size of the smallest input.B@return a specific byte indexed by a number from 0 in a bytearray"unsafe, no bound checking are doneC7Split a bytearray at a specific length in two bytearrayD%Take the first @n byte of a bytearrayE%drop the first @n byte of a bytearrayF:Split a bytearray at the point where @pred becomes invalidG-Concatenate bytearray into a larger bytearrayH!append one bytearray to the otherIJDuplicate a bytearray into another bytearray, and run an initializer on itJ Similar to I> but also provide a way to return a value from the initializerK Similiar to I5 but expect the resulting bytearray in a pure contextLFCreate a bytearray of a specific size containing a repeated byte valueM6Create a bytearray of a specific size initialized to 0N!Check if two bytearray are equalsUThis is not constant time, as soon some byte differs the function will returns. use O+ in sensitive context where timing matters.O;A constant time equality test for 2 ByteArrayAccess values._If values are of 2 different sizes, the function will abort early without comparing any bytes.compared to == , this function will go over all the bytes present before yielding a result even when knowing the overall result early in the processing.P0Convert a bytearray to another type of bytearray89:;<=>?@ABCDEFGHIJKLMNOP89:;<=>?@ABCDEFGHIJKLMNOP89:;<=>?@ABCDEFGHIJKLMNOP BSD-style&Nicolas DI PRIMA <nicolas@di-prima.fr>stableGoodNoneQa view on a given bytesEquality test in constant timeR"create a view on a given bytearrayCThis function update the offset and the size in order to guarantee: offset >= 0 size >= 0offset < lengthsize =< length - offsetS&create a view from the given bytearrayTWcreate a view from the given byte array starting after having dropped the fist n bytes QDEFGHRthe byte array we put a view on%the offset to start the byte array onthe size of the viewS byte araysize of the viewT byte array7the number of bytes do dropped before creating the viewIJKLQRST QDEFGHRSTIJKL  BSD-style#Vincent Hanquez <vincent@snarc.org> experimentalunknownNoneU Different bases that can be usedXsimilar to hexadecimalYGConvert a bytearray to the equivalent representation in a specific BaseZPTry to Convert a bytearray from the equivalent representation in a specific BaseUVWXYZUVWXYZYZUXWVUXWVYZ  BSD-style#Vincent Hanquez <vincent@snarc.org>stableGoodNone[STransform a bytearray at a specific offset into a Word64 tagged as BE (Big Endian)no bounds checking. unsafe\VTransform a bytearray at a specific offset into a Word64 tagged as LE (Little Endian)no bounds checking. unsafe]map blocks of 128 bits of a bytearray, creating a new bytestring of equivalent size where each blocks has been mapped through @f "no length checking is done. unsafe^map blocks of 64 bits of a bytearray, creating a new bytestring of equivalent size where each blocks has been mapped through @f "no length checking is done. unsafe[\]^[\]^[\^][\]^  BSD-style#Vincent Hanquez <vincent@snarc.org> experimentalportableNoneHM_"Simple ByteString parser structure`3Simple parsing result, that represent respectively:failure: with the error message+continuation: that need for more input data9success: the remaining unparsed data and the parser valued&Run a parser on an @initial byteArray.|If the Parser need more data than available, the @feeder function is automatically called and fed to the More continuation.e*Run a Parser on a ByteString and return a `f!Get the next byte from the parserg)Parse a specific byte at current positionQif the byte is different than the expected on, this parser will raise a failure.h/Parse a sequence of bytes from current positiongif the following bytes don't match the expected bytestring completely, the parser will raise a failurei7Take a storable from the current position in the streamj5Take @n bytes from the current position in the streamkLTake bytes while the @predicate hold from the current position in the streaml@Take the remaining bytes from the current position in the streamm5Skip @n bytes from the current position in the streamnLSkip bytes while the @predicate hold from the current position in the streamoDSkip all the remaining bytes from the current position in the stream_MNOP`abcdeQRSfghijklmnoTUVWXY_`abcdefghijklmno_`cbaedgfhjklmnoi_MNOP`cbadeQRSfghijklmnoTUVWXY BSD-style#Vincent Hanquez <vincent@snarc.org> experimentalgoodNonep8Compute the SipHash tag of a byte array for a given key.p# is equivalent to 'sipHashWith 2 4'q8Compute the SipHash tag of a byte array for a given key.2The user can choose the C and D numbers of rounds.calling p# is equivalent to 'sipHashWith 2 4'r2Compute the FNV1 32 bit hash value of a byte arrays3Compute the FNV1a 32 bit hash value of a byte arrayt2Compute the FNV1 64 bit hash value of a byte arrayu3Compute the FNV1a 64 bit hash value of a byte arraypqc roundsd roundskey data to hashrstu"#$%&'()pqrstu$%"#pq()&'rstupqrstu BSD-style#Vincent Hanquez <vincent@snarc.org>stableGoodNone;&*+,-./01289:;<=>?@ABCDEFGHIJKLMNOPQRST',-.*+/0123QRST8:9;>?@<=LMIDEFPJKCABNOHG  BSD-Style#Vincent Hanquez <vincent@snarc.org> experimentalunknownNone v>fill a given sized buffer with the result of the Packer actionw/pack the given packer into the given bytestringx6put a storable from the current position in the streamy8put a Byte Array from the current position in the stream)If the ByteArray is null, then do nothingz7skip some bytes from the current position in the stream{Cskip the size of a storable from the current position in the stream|:fill up from the current position in the stream to the end7it is basically: > fillUpWith s == fillList (repeat s)}UWill put the given storable list from the current position in the stream to the end.jThis function will fail with not enough storage if the given storable can't be written (not enough space)=example: > pack (fillList $ [1..] :: Word8) 9 ==> "123456789" > pack (fillList $ [1..] :: Word32) 4 ==> "1000" > pack (fillList $ [1..] :: Word32) 64 -- will work > pack (fillList $ [1..] :: Word32) 1 -- will fail (not enough space) > pack (fillList $ [1..] :: Word32) 131 -- will fail (not enough space)~/put Word8 in the current position in the streamHput Word16 in the current position in the stream /! use Host EndiannessHput Word32 in the current position in the stream /! use Host Endianness vwZxyz{|}~4567vwxyz{|}~4576vw~xy}|z{ vwZxyz{|}~[ !"#$%&'()*+,-./001223456789:;<<==>>??@ABCDEFGGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghi j k l m n o p q r s t J u v w x y z { | } Y ~   S                   Q       V !""#$%&'(E)*+,-./0123456789:;<F=>?@AB,CDEFGHIJKLMNOIPQRSTUVWfXYZ[\]^_ t ` a b c d e f g h i j k lm memory-0.6Data.Memory.ExtendedWordsData.Memory.PtrMethodsData.Memory.Encoding.Base16Data.Memory.Encoding.Base32Data.Memory.Encoding.Base64Data.Memory.EndianData.ByteArray.HashData.ByteArrayData.ByteArray.PackData.ByteArray.EncodingData.ByteArray.MappingData.ByteArray.ParseData.Memory.MemMap.PosixData.Memory.Internal.DeepSeq!Data.Memory.Internal.CompatPrim64Data.Memory.Internal.CompatPrimData.Memory.Internal.ScrubberData.Memory.Internal.ImportsData.Memory.Internal.CompatData.Memory.Hash.SipHashData.Memory.Hash.FNVData.ByteArray.TypesData.ByteArray.BytesData.ByteArray.ScrubbedBytesData.ByteArray.MemViewData.ByteArray.Pack.InternalData.ByteArray.MethodsData.ByteArray.ViewWord128memCreateTemporarymemXor memXorWithmemCopymemSetmemEqual memCompare memConstEqualshowHexadecimal toHexadecimalfromHexadecimaltoBase32unBase32Length fromBase32toBase64unBase64Length fromBase64ByteSwapBEunBELEunLE Endianness BigEndian LittleEndiangetSystemEndiannesstoBEfromBEtoLEfromLESipHashSipKey FnvHash64 FnvHash32 ByteArrayallocRetByteArrayAccesslength withByteArrayBytes ScrubbedBytesMemView memViewPlusPackerResult PackerFail PackerMorealloccreateallocAndFreeze unsafeCreateemptynullpackunpackunconsxorindexsplitAttakedropspanconcatappendcopycopyRet copyAndFreeze replicatezeroeqconstEqconvertViewviewtakeViewdropViewBaseBase64Base32Base16 convertToBaseconvertFromBasetoW64BEtoW64LE mapAsWord128 mapAsWord64ParserParseOK ParseMore ParseFail parseFeedparseanyBytebytebytes takeStorable takeWhiletakeAllskip skipWhileskipAllsipHash sipHashWithfnv1Hash fnv1aHash fnv1_64Hash fnv1a_64Hashfill putStorableputBytes skipStorable fillUpWithfillListputWord8 putWord16 putWord32MemorySyncFlagMemorySyncInvalidateMemorySyncSyncMemorySyncAsync MemoryAdviceMemoryAdviceDontNeedMemoryAdviceWillNeedMemoryAdviceSequentialMemoryAdviceRandomMemoryAdviceNormalMemoryProtection MemoryMapFlagMemoryMapPrivateMemoryMapShared memoryMap memoryUnmap memoryAdvise memoryLock memoryUnlock memoryProtect memorySyncsysconfPageSizeMemoryProtectionExecuteMemoryProtectionWriteMemoryProtectionReadMemoryProtectionNone c_sysconf c_munlockc_mlock c_mprotectc_msync c_madvisec_munmapc_mmapcvalueOfMemoryProtscvalueOfMemorySyncdeepseq-1.3.0.2Control.DeepSeqrnfNFDataInt64#Word64#OutBool eqWord64# neWord64# ltWord64# leWord64# gtWord64# geWord64#eqInt64#neInt64#ltInt64#leInt64#gtInt64#geInt64# quotInt64# remInt64#and64#or64#xor64#not64#uncheckedShiftL64#uncheckedShiftRL64#int64ToWord64#word64ToInt64# intToInt64# int64ToInt# wordToWord64# word64ToWord# timesWord64#w64#be32Primle32Primbyteswap32Prim booleanPrimeitherDivideBy8# getScrubber scrubBytesbase Control.ArrowfirstControl.Applicative<*>pure Alternative Applicativeghc-prim GHC.TypesWordGHC.WordWord8Word16Word32Word64optionalliftA3liftA2liftA<**><**>manysome<|>getConstConst unwrapMonad WrapMonad WrappedMonad unwrapArrow WrapArrow WrappedArrow getZipListZipListsecond Data.Functor<$> byteSwap64 byteSwap32 byteSwap16 Control.MonadvoidforM_forMGHC.Base<$ Data.Bitsc_memcpyc_memset unsafeDoIOpopCount unsafeShiftR unsafeShiftLString convertBytetoBase32Per5BytesfromBase32Per8Bytesconvert3byteSwap$fByteSwapWord64$fByteSwapWord32$fByteSwapWord16hashhashWith InternalStatefnv1fnv1afnv1_64fnv1a_64$fByteArrayByteString$fByteArrayAccessByteStringnewBytes touchBytes sizeofByteswithPtr bytesAlloc bytesConcat bytesAppend bytesAllocRet bytesLength withBytesbytesEq bytesComparebytesUnpackChars$fByteArrayBytes$fByteArrayAccessBytes $fNFDataBytes $fMonoidBytes $fOrdBytes $fEqBytes $fShowBytesnewScrubbedBytesscrubbedBytesAllocRetscrubbedBytesAllocscrubbedBytesConcatscrubbedBytesAppendsizeofScrubbedBytestouchScrubbedBytesscrubbedBytesEqscrubbedBytesCompare$fByteArrayScrubbedBytes$fByteArrayAccessScrubbedBytes$fNFDataScrubbedBytes$fMonoidScrubbedBytes$fOrdScrubbedBytes$fEqScrubbedBytes$fShowScrubbedBytes$fByteArrayAccessMemView actionPackeractionPackerWithRemain runPacker_ fmapPacker returnPacker bindPacker appendPacker $fMonadPacker$fApplicativePacker$fFunctorPacker viewOffsetviewSizeunViewviewUnpackChars$fByteArrayAccessView $fShowView $fOrdView$fEqView runParserSuccessFailuregetMoregetAllflushAll$fAlternativeParser$fApplicativeParser$fFunctorParser$fMonadPlusParser $fMonadParser $fShowResultfillUpWithWord8'