summaryrefslogtreecommitdiff
path: root/src/Data
diff options
context:
space:
mode:
authorSam T <pxqr.sta@gmail.com>2013-06-13 02:14:28 +0400
committerSam T <pxqr.sta@gmail.com>2013-06-13 02:14:28 +0400
commit6042f69d711cddc0bb42457e0d16d45e7b34e431 (patch)
treeeebedcbd5cb46c5d033e89aae71b8ad5c3584a94 /src/Data
parent4e30588737415d59fa36aa7308c037bb8bd8e3d5 (diff)
~ Fix wall suggestions.
Diffstat (limited to 'src/Data')
-rw-r--r--src/Data/Bitfield.hs10
-rw-r--r--src/Data/Torrent.hs5
2 files changed, 7 insertions, 8 deletions
diff --git a/src/Data/Bitfield.hs b/src/Data/Bitfield.hs
index 18f80a4e..11897786 100644
--- a/src/Data/Bitfield.hs
+++ b/src/Data/Bitfield.hs
@@ -160,7 +160,7 @@ completeness :: Bitfield -> Ratio PieceCount
160completeness b = haveCount b % totalCount b 160completeness b = haveCount b % totalCount b
161 161
162inRange :: PieceIx -> Bitfield -> Bool 162inRange :: PieceIx -> Bitfield -> Bool
163inRange ix bf @ Bitfield {..} = 0 <= ix && ix < bfSize 163inRange ix Bitfield {..} = 0 <= ix && ix < bfSize
164 164
165member :: PieceIx -> Bitfield -> Bool 165member :: PieceIx -> Bitfield -> Bool
166member ix bf @ Bitfield {..} 166member ix bf @ Bitfield {..}
@@ -319,11 +319,11 @@ data StartegyClass
319strategyClass :: Ratio PieceCount -> Bitfield -> StartegyClass 319strategyClass :: Ratio PieceCount -> Bitfield -> StartegyClass
320strategyClass threshold = classify . completeness 320strategyClass threshold = classify . completeness
321 where 321 where
322 classify have 322 classify c
323 | have < threshold = SCBeginning 323 | c < threshold = SCBeginning
324 | have + 1 % numerator have < 1 = SCReady 324 | c + 1 % numerator c < 1 = SCReady
325 -- FIXME numerator have is not total count 325 -- FIXME numerator have is not total count
326 | otherwise = SCEnd 326 | otherwise = SCEnd
327 327
328 328
329-- | Select the first available piece. 329-- | Select the first available piece.
diff --git a/src/Data/Torrent.hs b/src/Data/Torrent.hs
index ad57403e..1af8ece2 100644
--- a/src/Data/Torrent.hs
+++ b/src/Data/Torrent.hs
@@ -57,7 +57,6 @@ import Prelude hiding (sum)
57import Control.Applicative 57import Control.Applicative
58import Control.Arrow 58import Control.Arrow
59import Control.Exception 59import Control.Exception
60import Control.Monad
61import Data.BEncode as BE 60import Data.BEncode as BE
62import Data.Char 61import Data.Char
63import Data.Foldable 62import Data.Foldable
@@ -359,8 +358,8 @@ isMultiFile _ = False
359 358
360-- | Read and decode a .torrent file. 359-- | Read and decode a .torrent file.
361fromFile :: FilePath -> IO Torrent 360fromFile :: FilePath -> IO Torrent
362fromFile path = do 361fromFile filepath = do
363 contents <- B.readFile path 362 contents <- B.readFile filepath
364 case decoded contents of 363 case decoded contents of
365 Right !t -> return t 364 Right !t -> return t
366 Left msg -> throwIO $ userError $ msg ++ " while reading torrent" 365 Left msg -> throwIO $ userError $ msg ++ " while reading torrent"