diff options
-rw-r--r-- | bencoding.cabal | 2 | ||||
-rw-r--r-- | src/Data/BEncode.hs | 10 |
2 files changed, 6 insertions, 6 deletions
diff --git a/bencoding.cabal b/bencoding.cabal index e2e4775..0daecde 100644 --- a/bencoding.cabal +++ b/bencoding.cabal | |||
@@ -31,7 +31,7 @@ library | |||
31 | exposed-modules: Data.BEncode | 31 | exposed-modules: Data.BEncode |
32 | build-depends: base == 4.* | 32 | build-depends: base == 4.* |
33 | , containers >= 0.4 | 33 | , containers >= 0.4 |
34 | , bytestring >= 0.10.2.0 | 34 | , bytestring >= 0.10.0.0 |
35 | , attoparsec >= 0.10 | 35 | , attoparsec >= 0.10 |
36 | , text >= 0.11 | 36 | , text >= 0.11 |
37 | , pretty | 37 | , pretty |
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 |