summaryrefslogtreecommitdiff
path: root/src/Data/Torrent/Bitfield.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Data/Torrent/Bitfield.hs')
-rw-r--r--src/Data/Torrent/Bitfield.hs5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/Data/Torrent/Bitfield.hs b/src/Data/Torrent/Bitfield.hs
index 176ba2c0..d564e353 100644
--- a/src/Data/Torrent/Bitfield.hs
+++ b/src/Data/Torrent/Bitfield.hs
@@ -37,6 +37,7 @@ module Data.Torrent.Bitfield
37 37
38 -- * Query 38 -- * Query
39 , Data.Torrent.Bitfield.null 39 , Data.Torrent.Bitfield.null
40 , Data.Torrent.Bitfield.full
40 , haveCount, totalCount, completeness 41 , haveCount, totalCount, completeness
41 42
42 , member, notMember 43 , member, notMember
@@ -135,6 +136,10 @@ interval pc a b = Bitfield pc (S.interval a b)
135null :: Bitfield -> Bool 136null :: Bitfield -> Bool
136null Bitfield {..} = S.null bfSet 137null Bitfield {..} = S.null bfSet
137 138
139-- | Test if bitfield have all pieces.
140full :: Bitfield -> Bool
141full Bitfield {..} = S.size bfSet == bfSize
142
138-- | Count of peer have pieces. 143-- | Count of peer have pieces.
139haveCount :: Bitfield -> PieceCount 144haveCount :: Bitfield -> PieceCount
140haveCount = S.size . bfSet 145haveCount = S.size . bfSet