diff options
Diffstat (limited to 'src/Data/Bitfield.hs')
-rw-r--r-- | src/Data/Bitfield.hs | 10 |
1 files changed, 5 insertions, 5 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. |