summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Truzjan <pxqr.sta@gmail.com>2013-09-29 06:19:08 +0400
committerSam Truzjan <pxqr.sta@gmail.com>2013-09-29 06:19:08 +0400
commitf314e3ca292c3a25241c8752ec9f067a95c1eb39 (patch)
treedbfe19c6d16b4da7fab81873d67e7e75b9c6d225
parenta7f121250cf9409409ff90f9cedf284bf3cab317 (diff)
Code style
-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 086d34f..6b26ee5 100644
--- a/src/Data/BEncode.hs
+++ b/src/Data/BEncode.hs
@@ -786,20 +786,20 @@ parser = valueP
786 case c of 786 case c of
787 -- if we have digit it always should be string length 787 -- if we have digit it always should be string length
788 di | di <= '9' -> BString <$> stringP 788 di | di <= '9' -> BString <$> stringP
789 'i' -> P.anyChar *> ((BInteger <$> integerP) <* P.anyChar) 789 'i' -> P.anyChar *> ((BInteger <$> integerP) <* P.anyChar)
790 'l' -> P.anyChar *> ((BList <$> listBody) <* P.anyChar) 790 'l' -> P.anyChar *> ((BList <$> listBodyP) <* P.anyChar)
791 'd' -> P.anyChar *> (BDict <$> dictBodyP)<* P.anyChar 791 'd' -> P.anyChar *> (BDict <$> dictBodyP) <* P.anyChar
792 t -> fail ("bencode unknown tag: " ++ [t]) 792 t -> fail ("bencode unknown tag: " ++ [t])
793 793
794 dictBodyP :: Parser BDict 794 dictBodyP :: Parser BDict
795 dictBodyP = Cons <$> stringP <*> valueP <*> dictBodyP 795 dictBodyP = Cons <$> stringP <*> valueP <*> dictBodyP
796 <|> pure Nil 796 <|> pure Nil
797 797
798 listBody = do 798 listBodyP = do
799 c <- P.peekChar 799 c <- P.peekChar
800 case c of 800 case c of
801 Just 'e' -> return [] 801 Just 'e' -> return []
802 _ -> (:) <$> valueP <*> listBody 802 _ -> (:) <$> valueP <*> listBodyP
803 803
804 stringP :: Parser ByteString 804 stringP :: Parser ByteString
805 stringP = do 805 stringP = do