summaryrefslogtreecommitdiff
path: root/src/Data/BEncode.hs
diff options
context:
space:
mode:
authorSam T <pxqr.sta@gmail.com>2013-06-28 14:39:57 +0400
committerSam T <pxqr.sta@gmail.com>2013-06-28 14:39:57 +0400
commitd1ef5f2079d78d628ff0670bc33de4f3738e6b51 (patch)
treeb0db165c70d3638f52b66950d48f79f04154f8b6 /src/Data/BEncode.hs
parent1cd16efea0b982cac9f8ee4d0917bc12ba91b46d (diff)
~ Use older bytestring.
Diffstat (limited to 'src/Data/BEncode.hs')
-rw-r--r--src/Data/BEncode.hs10
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)
87import qualified Data.ByteString as B 87import qualified Data.ByteString as B
88import qualified Data.ByteString.Char8 as BC 88import qualified Data.ByteString.Char8 as BC
89import qualified Data.ByteString.Lazy as Lazy 89import qualified Data.ByteString.Lazy as Lazy
90import qualified Data.ByteString.Lazy.Builder as B
91import qualified Data.ByteString.Lazy.Builder.ASCII as ASCII
90import Data.ByteString.Internal as B (c2w, w2c) 92import Data.ByteString.Internal as B (c2w, w2c)
91import qualified Data.ByteString.Builder as B
92import qualified Data.ByteString.Builder.Prim as BP (int64Dec, primBounded)
93import Data.Text (Text) 93import Data.Text (Text)
94import qualified Data.Text.Encoding as T 94import qualified Data.Text.Encoding as T
95import Data.Version 95import Data.Version
@@ -387,7 +387,7 @@ builder :: BEncode -> B.Builder
387builder = go 387builder = 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