diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Network/BitTorrent/Tracker/List.hs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/Network/BitTorrent/Tracker/List.hs b/src/Network/BitTorrent/Tracker/List.hs index f2a4b264..5ab43c86 100644 --- a/src/Network/BitTorrent/Tracker/List.hs +++ b/src/Network/BitTorrent/Tracker/List.hs | |||
@@ -9,6 +9,7 @@ | |||
9 | -- | 9 | -- |
10 | -- For more info see: <http://www.bittorrent.org/beps/bep_0012.html> | 10 | -- For more info see: <http://www.bittorrent.org/beps/bep_0012.html> |
11 | -- | 11 | -- |
12 | {-# LANGUAGE FlexibleInstances #-} | ||
12 | module Network.BitTorrent.Tracker.List | 13 | module Network.BitTorrent.Tracker.List |
13 | ( -- * Tracker list | 14 | ( -- * Tracker list |
14 | TrackerList | 15 | TrackerList |
@@ -25,6 +26,7 @@ module Network.BitTorrent.Tracker.List | |||
25 | import Prelude hiding (mapM, foldr) | 26 | import Prelude hiding (mapM, foldr) |
26 | import Control.Applicative | 27 | import Control.Applicative |
27 | import Control.Exception | 28 | import Control.Exception |
29 | import Data.Default | ||
28 | import Data.List as L (elem, any, filter, null) | 30 | import Data.List as L (elem, any, filter, null) |
29 | import Data.Maybe | 31 | import Data.Maybe |
30 | import Data.Foldable | 32 | import Data.Foldable |
@@ -49,6 +51,10 @@ data TrackerList a | |||
49 | | TierList [Tier a] -- ^ torrent file 'announce-list' field only | 51 | | TierList [Tier a] -- ^ torrent file 'announce-list' field only |
50 | deriving (Show, Eq) | 52 | deriving (Show, Eq) |
51 | 53 | ||
54 | -- | Empty tracker list. Can be used for trackerless torrents. | ||
55 | instance Default (TrackerList URI) where | ||
56 | def = TierList [] | ||
57 | |||
52 | instance Functor TrackerList where | 58 | instance Functor TrackerList where |
53 | fmap f (Announce a) = Announce (f a) | 59 | fmap f (Announce a) = Announce (f a) |
54 | fmap f (TierList a) = TierList (fmap (fmap f) a) | 60 | fmap f (TierList a) = TierList (fmap (fmap f) a) |