!kGdo      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmn(c) Sam Truzjan 2013BSD3pxqr.sta@gmail.comstableportableSafe7u  bencoding@BDictMap is an ascending list of key/value pairs sorted by keys. bencodingO(1). The empty dicionary. bencodingO(1)#. Dictionary of one key-value pair. bencodingO(1). Is the dictionary empty? bencodingO(n)(. Is the key a member of the dictionary? bencodingO(n).. Lookup the value at a key in the dictionary.  bencodingO(n + m)[. Merge two dictionaries by taking pair from both given dictionaries. Dublicated keys are not filtered.  bencodingO(n).2 Map a function over all values in the dictionary.  bencodingO(n).< Map a function over all keys/value pairs in the dictionary.  bencodingO(n)H. Map each key/value pair to a monoid and fold resulting sequnce using o.  bencodingO(n)H. Map each key/value pair to a monoid and fold resulting sequnce using o. bencodingO(n)[. Build a dictionary from a list of key/value pairs where the keys are in ascending order. bencodingO(n)]. Convert the dictionary to a list of key/value pairs where the keys are in ascending order.  (c) Sam Truzjan 2013BSD3pxqr.sta@gmail.comstableportableSafe7#<  bencoding is straightforward ADT for b-encoded values. Please note that since dictionaries are sorted, in most cases we can compare BEncoded values without serialization and vice versa. Lists is not required to be sorted through. bencodingbencode integers; bencodingbencode strings; bencodinglist of bencode values; bencodingbencode key-value dictionary. bencodingA bencode dictionary.  bencodingA plain bencode list.! bencodingA raw bencode string." bencodingA bencode "integer".# bencoding%Test if bencoded value is an integer.$ bencoding>Test if bencoded value is a string, both raw and utf8 encoded.% bencoding!Test if bencoded value is a list.& bencoding'Test if bencoded value is a dictionary.  !"#$%& "! #$%&(c) Sam Truzjan 2013BSD3pxqr.sta@gmail.comstableportableNoneF*- bencoding2BEncode format encoder according to specification.. bencodingIConvert bencoded value to raw bytestring according to the specification./ bencoding1BEncode format parser according to specification.0 bencodingLTry to convert raw bytestring to bencoded value according to specification.1 bencodingVConvert to easily readable JSON-like document. Typically used for debugging purposes.-./01/0-.1(c) Sam Truzjan 2013BSD3pxqr.sta@gmail.comstableportable Trustworthy 8=>?@AMUVXc62 bencodingnDictionary extractor are similar to dictionary builders, but play the opposite role: they are used to define 6. method in declarative style. Using the same FileInfo datatype the 6 function instance looks like:  instance 4 FileInfo where 6 = H $ do FileInfo D "length" G "md5sum" F "path" G "tags" The reqKeyW is used to extract required key  if lookup is failed then whole destructuring fail.DNOTE: the actions MUST be sorted lexicographically by keys, like so: "length" p "md5sum" p "path" p "tags"3 bencodingAssoc used to easily build dictionaries with required and optional keys. Suppose we have we following datatype we want to serialize:  data FileInfo = FileInfo { fileLength :: Integer , fileMD5sum :: Maybe ByteString , filePath :: [ByteString] , fileTags :: Maybe [Text] } deriving (Show, Read, Eq) We need to make  instance 4 FileInfo*, though we don't want to check the both qCs manually. The more declarative and convenient way to define the 5' method is to use dictionary builders:  instance 4 FileInfo where 5 FileInfo {..} = < $ "length" 9 fileLength ; "md5sum" : fileMD5sum ; "path" 9 filePath ; "tags" : fileTags ; = LNOTE: the list of pairs MUST be sorted lexicographically by keys, like so: "length" p "md5sum" p "path" p "tags"4 bencodingaThis class is used to define new datatypes that could be easily serialized using bencode format. By default 4B have a generic implementation; suppose the following datatype: qdata List a = C { _head :: a , __tail :: List a } | N deriving GenericIf we don't need to obey any particular specification or standard, the default instance could be derived automatically from the r instance: &instance BEncode a => BEncode (List a)Example of derived 5 result: V> toBEncode (C 123 $ C 1 N) BDict (fromList [("head",BInteger 123),("tail",BList [])])\Note that prefixed underscore characters are omitted since they are usually used for lens.5 bencoding&See an example of implementation here 36 bencoding&See an example of implementation here 2.7 bencoding#Result used in decoding operations.8 bencodingfTypically used to throw an decoding error in fromBEncode; when BEncode value to match expected value.9 bencodingMake required key value pair.: bencoding Like the (9g) operator but if the value is not present then the key do not appear in resulting bencode dictionary.; bencodingCons a key/value pair.< bencoding1Make a bencode value from dictionary description.= bencoding'Used to specify end of dictionary. See 3.> bencodingXRun action, but return without consuming and key/value pair. Fails if the action fails.? bencoding<Get lexicographical successor of the current key/value pair.@ bencodingExtract required value from the given key.A bencoding*Extract optional value from the given key.B bencoding2Reconstruct a bencodable value from bencode value.C bencodingMatch key with value.D bencodingShorthand for: f s B (@ k).E bencodingShorthand for: f s t (B (@ k)).F bencodingShorthand for: f u B (@ k).G bencodingShorthand for: f u t (B (@ k)).H bencodingRun a 2 monad. See 2 for usage.I bencodingDecode a value from a strict v using bencode format.J bencoding.Encode a value using bencode format to a lazy v.k bencodingw is catchable from pure code.23456789:;<=>?@ABCDEFGHIJ456JI39:;=<278H>?@ABCDEFG96:6;5D4E4F4G4x      !"##"! $%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstupvwpxypz{p|}pq~pq(bencoding-0.4.5.2-Lcs15Vg9mMCBfNjcq0GuFQData.BEncode.BDictData.BEncode.TypesData.BEncode.Internal Data.BEncodeBDictMapConsNilBKeyempty singletonnullmemberlookupunionmap mapWithKeyfoldMapWithKey bifoldMap fromAscList toAscList$fMonoidBDictMap$fSemigroupBDictMap$fFoldableBDictMap$fFunctorBDictMap$fNFDataBDictMap$fShowBDictMap$fReadBDictMap $fEqBDictMap $fOrdBDictMap$fGenericBDictMapBValueBIntegerBStringBListBDict isIntegerisStringisListisDict$fNFDataBValue $fShowBValue $fReadBValue $fEqBValue $fOrdBValue$fGenericBValuebuilderbuildparserparse ppBEncodeGetAssocBEncode toBEncode fromBEncodeResult decodingError.=!.=?.:toDictendDict lookAheadnextreqoptfieldmatch<$>!<$>?<*>!<*>?fromDictdecodeencode$fGBEncodableM1e$fGBEncodableM1BValue$fGBEncodableM1[]$fGBEncodableM1BDictMap$fGBEncodable:+:e$fGBEncodable:*:BDictMap$fGBEncodable:*:[]$fGBEncodableU1e$fBEncode(,,,,)$fBEncode(,,,) $fBEncode(,,) $fBEncode(,) $fBEncode()$fBEncodeVersion $fBEncode[] $fBEncodeText $fBEncodeBool $fBEncodeInt$fBEncodeInt64$fBEncodeInt32$fBEncodeInt16 $fBEncodeInt8 $fBEncodeWord$fBEncodeWord64$fBEncodeWord32$fBEncodeWord16$fBEncodeWord8$fBEncodeBDictMap$fBEncodeByteString$fBEncodeInteger$fBEncodeBValue$fGBEncodableK1BValue $fMonadGet $fFunctorGet$fApplicativeGet$fAlternativeGetbaseGHC.Basemappendghc-prim GHC.Classes< GHC.MaybeMaybe GHC.GenericsGeneric Data.Functor<$>Control.Applicativeoptional<*>bytestring-0.10.8.2Data.ByteString.Internal ByteStringfail