From: Ramakrishnan Muthukrishnan <ram@rkrishnan.org>
Date: Tue, 17 Feb 2015 06:06:27 +0000 (+0530)
Subject: fix changed made during sleep deprived state
X-Git-Url: https://git.rkrishnan.org/pf/content/en/seg/priv/module-simplejson.tests.html?a=commitdiff_plain;h=75cf17f2eee68732a4cac4fbb6462db310b667c6;p=functorrent.git

fix changed made during sleep deprived state
---

diff --git a/src/Bencode.hs b/src/Bencode.hs
index 75ae077..6b46a92 100644
--- a/src/Bencode.hs
+++ b/src/Bencode.hs
@@ -132,6 +132,6 @@ encode (Bstr bs) = let s = BC.unpack bs
                    in show (length s) ++ ":" ++ s
 encode (Bint i) = "i" ++ show i ++ "e"
 encode (Blist xs) = "l" ++ encodeList xs ++ "e"
-  where encodeList = foldr (++ encode x) ""
+  where encodeList = foldr (\x -> (++ encode x)) ""
 encode (Bdict d) = "d" ++ encodeDict d ++ "e"
   where encodeDict m = concat [encode k ++ encode (m M.! k) | k <- M.keys m]
diff --git a/src/Tracker.hs b/src/Tracker.hs
index 5df314c..52dccdd 100644
--- a/src/Tracker.hs
+++ b/src/Tracker.hs
@@ -20,9 +20,9 @@ type Url = String
 -- "%124Vx%9a%bc%de%f1%23Eg%89%ab%cd%ef%124Vx%9a"
 urlEncode :: BC.ByteString -> String
 urlEncode bs = concatMap (encode . BC.unpack) (U.splitN 2 bs)
-  where encode b@[c1 : c2] = let c =  chr (read ("0x" ++ b))
-                             in
-                              escape c c1 c2
+  where encode b@(c1 : c2 : []) = let c =  chr (read ("0x" ++ b))
+                                  in
+                                   escape c c1 c2
         encode _ = ""
         escape i c1 c2 | i `elem` nonSpecialChars = [i]
                        | otherwise = "%" ++ [c1] ++ [c2]