diff options
author | Sam T <pxqr.sta@gmail.com> | 2013-06-28 14:39:57 +0400 |
---|---|---|
committer | Sam T <pxqr.sta@gmail.com> | 2013-06-28 14:39:57 +0400 |
commit | d1ef5f2079d78d628ff0670bc33de4f3738e6b51 (patch) | |
tree | b0db165c70d3638f52b66950d48f79f04154f8b6 /src/Data/BEncode.hs | |
parent | 1cd16efea0b982cac9f8ee4d0917bc12ba91b46d (diff) |
~ Use older bytestring.
Diffstat (limited to 'src/Data/BEncode.hs')
-rw-r--r-- | src/Data/BEncode.hs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/Data/BEncode.hs b/src/Data/BEncode.hs index 4b80d4a..2f1125e 100644 --- a/src/Data/BEncode.hs +++ b/src/Data/BEncode.hs | |||
@@ -87,9 +87,9 @@ import Data.ByteString (ByteString) | |||
87 | import qualified Data.ByteString as B | 87 | import qualified Data.ByteString as B |
88 | import qualified Data.ByteString.Char8 as BC | 88 | import qualified Data.ByteString.Char8 as BC |
89 | import qualified Data.ByteString.Lazy as Lazy | 89 | import qualified Data.ByteString.Lazy as Lazy |
90 | import qualified Data.ByteString.Lazy.Builder as B | ||
91 | import qualified Data.ByteString.Lazy.Builder.ASCII as ASCII | ||
90 | import Data.ByteString.Internal as B (c2w, w2c) | 92 | import Data.ByteString.Internal as B (c2w, w2c) |
91 | import qualified Data.ByteString.Builder as B | ||
92 | import qualified Data.ByteString.Builder.Prim as BP (int64Dec, primBounded) | ||
93 | import Data.Text (Text) | 93 | import Data.Text (Text) |
94 | import qualified Data.Text.Encoding as T | 94 | import qualified Data.Text.Encoding as T |
95 | import Data.Version | 95 | import Data.Version |
@@ -387,7 +387,7 @@ builder :: BEncode -> B.Builder | |||
387 | builder = go | 387 | builder = go |
388 | where | 388 | where |
389 | go (BInteger i) = B.word8 (c2w 'i') <> | 389 | go (BInteger i) = B.word8 (c2w 'i') <> |
390 | BP.primBounded BP.int64Dec i <> -- TODO FIXME | 390 | ASCII.int64Dec i <> |
391 | B.word8 (c2w 'e') | 391 | B.word8 (c2w 'e') |
392 | go (BString s) = buildString s | 392 | go (BString s) = buildString s |
393 | go (BList l) = B.word8 (c2w 'l') <> | 393 | go (BList l) = B.word8 (c2w 'l') <> |
@@ -399,7 +399,7 @@ builder = go | |||
399 | where | 399 | where |
400 | mkKV (k, v) = buildString k <> go v | 400 | mkKV (k, v) = buildString k <> go v |
401 | 401 | ||
402 | buildString s = B.intDec (B.length s) <> | 402 | buildString s = ASCII.intDec (B.length s) <> |
403 | B.word8 (c2w ':') <> | 403 | B.word8 (c2w ':') <> |
404 | B.byteString s | 404 | B.byteString s |
405 | {-# INLINE buildString #-} | 405 | {-# INLINE buildString #-} |
@@ -421,7 +421,7 @@ parser = valueP | |||
421 | 'd' -> do | 421 | 'd' -> do |
422 | P.anyChar | 422 | P.anyChar |
423 | (BDict . M.fromDistinctAscList <$> many ((,) <$> stringP <*> valueP)) | 423 | (BDict . M.fromDistinctAscList <$> many ((,) <$> stringP <*> valueP)) |
424 | <* P.anyChar | 424 | <* P.anyChar |
425 | t -> fail ("bencode unknown tag: " ++ [t]) | 425 | t -> fail ("bencode unknown tag: " ++ [t]) |
426 | 426 | ||
427 | listBody = do | 427 | listBody = do |