From 639dfd61fe8cbecac6f447c45dbb7f4f7263c904 Mon Sep 17 00:00:00 2001
From: Ramakrishnan Muthukrishnan <ram@rkrishnan.org>
Date: Sun, 19 Jul 2015 14:17:50 +0530
Subject: [PATCH] keep hlint happy

---
 src/FuncTorrent/Metainfo.hs |  2 +-
 src/FuncTorrent/Peer.hs     | 20 ++++++++++----------
 src/Main.hs                 |  2 +-
 3 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/src/FuncTorrent/Metainfo.hs b/src/FuncTorrent/Metainfo.hs
index daf008f..9eb9955 100644
--- a/src/FuncTorrent/Metainfo.hs
+++ b/src/FuncTorrent/Metainfo.hs
@@ -83,7 +83,7 @@ getAnnounceList (Just (Bdict _)) = []
 
 torrentToMetainfo :: ByteString -> Either String Metainfo
 torrentToMetainfo s =
-  case (decode s) of
+  case decode s of
    Right d ->
      mkMetaInfo d
    Left e ->
diff --git a/src/FuncTorrent/Peer.hs b/src/FuncTorrent/Peer.hs
index 490f080..5476121 100644
--- a/src/FuncTorrent/Peer.hs
+++ b/src/FuncTorrent/Peer.hs
@@ -28,10 +28,10 @@ type IP = String
 type Port = Integer
 
 data PeerState = PeerState { handle :: Handle
-                           , am_choking :: Bool
-                           , am_interested :: Bool
-                           , peer_choking :: Bool
-                           , peer_interested :: Bool}
+                           , amChoking :: Bool
+                           , amInterested :: Bool
+                           , peerChoking :: Bool
+                           , peerInterested :: Bool}
 
 -- Maintain info on every piece and the current state of it.
 -- should probably be a TVar.
@@ -173,14 +173,14 @@ bitfieldToList :: [Word8] -> [Integer]
 bitfieldToList bs = go bs 0
   where go [] _ = []
         go (b:bs') pos =
-          let setBits = [pos*8 + (toInteger i) | i <- [0..8], testBit b i]
+          let setBits = [pos*8 + toInteger i | i <- [0..8], testBit b i]
           in
-           setBits ++ (go bs' (pos + 1))
+           setBits ++ go bs' (pos + 1)
 
 -- downloadPiece :: Integer -> Handle -> IO ()
 
 createDummyFile :: FilePath -> Int -> IO ()
-createDummyFile path size = do
+createDummyFile path size =
   writeFile path (BC.replicate size '\0')
 
 -- loop1 :: shake hands with all peers, find out the pieces they have, form PieceData.
@@ -196,13 +196,13 @@ msgLoop h pieceHash =
      case msg of
       BitFieldMsg bss -> do
         let pieceList = bitfieldToList (unpack bss)
-        putStrLn (show pieceList)
+        print pieceList
         -- download each of the piece in order
-      _ -> putStrLn (show msg)
+      _ -> print msg
 
 handlePeerMsgs :: Peer -> Metainfo -> String -> (String -> IO ()) -> IO ()
 handlePeerMsgs p m peerId logFn = do
   h <- handShake p (infoHash m) peerId
-  logFn $ "handShake"
+  logFn "handShake"
   msgLoop h (pieces (info m))
   
diff --git a/src/Main.hs b/src/Main.hs
index 8171d38..12af02e 100644
--- a/src/Main.hs
+++ b/src/Main.hs
@@ -41,7 +41,7 @@ main = do
     log "Starting up functorrent"
     log $ "Parsing arguments " ++ concat args
     torrentStr <- parse args
-    case (torrentToMetainfo torrentStr) of
+    case torrentToMetainfo torrentStr of
      Left e -> logError e log
      Right m -> do
        log "Input File OK"
-- 
2.45.2