diff options
author | Sam T <pxqr.sta@gmail.com> | 2013-06-13 02:14:28 +0400 |
---|---|---|
committer | Sam T <pxqr.sta@gmail.com> | 2013-06-13 02:14:28 +0400 |
commit | 6042f69d711cddc0bb42457e0d16d45e7b34e431 (patch) | |
tree | eebedcbd5cb46c5d033e89aae71b8ad5c3584a94 /src/Data | |
parent | 4e30588737415d59fa36aa7308c037bb8bd8e3d5 (diff) |
~ Fix wall suggestions.
Diffstat (limited to 'src/Data')
-rw-r--r-- | src/Data/Bitfield.hs | 10 | ||||
-rw-r--r-- | src/Data/Torrent.hs | 5 |
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 | |||
160 | completeness b = haveCount b % totalCount b | 160 | completeness b = haveCount b % totalCount b |
161 | 161 | ||
162 | inRange :: PieceIx -> Bitfield -> Bool | 162 | inRange :: PieceIx -> Bitfield -> Bool |
163 | inRange ix bf @ Bitfield {..} = 0 <= ix && ix < bfSize | 163 | inRange ix Bitfield {..} = 0 <= ix && ix < bfSize |
164 | 164 | ||
165 | member :: PieceIx -> Bitfield -> Bool | 165 | member :: PieceIx -> Bitfield -> Bool |
166 | member ix bf @ Bitfield {..} | 166 | member ix bf @ Bitfield {..} |
@@ -319,11 +319,11 @@ data StartegyClass | |||
319 | strategyClass :: Ratio PieceCount -> Bitfield -> StartegyClass | 319 | strategyClass :: Ratio PieceCount -> Bitfield -> StartegyClass |
320 | strategyClass threshold = classify . completeness | 320 | strategyClass 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) | |||
57 | import Control.Applicative | 57 | import Control.Applicative |
58 | import Control.Arrow | 58 | import Control.Arrow |
59 | import Control.Exception | 59 | import Control.Exception |
60 | import Control.Monad | ||
61 | import Data.BEncode as BE | 60 | import Data.BEncode as BE |
62 | import Data.Char | 61 | import Data.Char |
63 | import Data.Foldable | 62 | import Data.Foldable |
@@ -359,8 +358,8 @@ isMultiFile _ = False | |||
359 | 358 | ||
360 | -- | Read and decode a .torrent file. | 359 | -- | Read and decode a .torrent file. |
361 | fromFile :: FilePath -> IO Torrent | 360 | fromFile :: FilePath -> IO Torrent |
362 | fromFile path = do | 361 | fromFile 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" |