From 950d728dc12302858f0c20d9890dc97975f4e9a9 Mon Sep 17 00:00:00 2001 From: Sam T Date: Sun, 5 May 2013 03:50:07 +0400 Subject: ~ Minor changes. --- src/Network/BitTorrent/PeerWire/Selection.hs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/Network/BitTorrent/PeerWire/Selection.hs') diff --git a/src/Network/BitTorrent/PeerWire/Selection.hs b/src/Network/BitTorrent/PeerWire/Selection.hs index 2e412e06..92285501 100644 --- a/src/Network/BitTorrent/PeerWire/Selection.hs +++ b/src/Network/BitTorrent/PeerWire/Selection.hs @@ -48,11 +48,10 @@ strictLast h a _ = findMax (difference a h) -- | rarestFirst :: Selector -rarestFirst h a xs = error "rarestFirst" - -- rarest (frequencies (map (intersection want) xs)) +rarestFirst h a xs = rarest (frequencies (map (intersection want) xs)) where want = difference h a - rarest = undefined + rarest = Just . head -- | In general random first is faster than rarest first strategy but -- only if all pieces are available. @@ -62,7 +61,7 @@ randomFirst = do error "randomFirst" endGame :: Selector -endGame = undefined +endGame = strictLast autoSelector :: Selector autoSelector = undefined -- cgit v1.2.3