summaryrefslogtreecommitdiff
path: root/src/Network/BitTorrent/Tracker
diff options
context:
space:
mode:
Diffstat (limited to 'src/Network/BitTorrent/Tracker')
-rw-r--r--src/Network/BitTorrent/Tracker/List.hs6
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 #-}
12module Network.BitTorrent.Tracker.List 13module Network.BitTorrent.Tracker.List
13 ( -- * Tracker list 14 ( -- * Tracker list
14 TrackerList 15 TrackerList
@@ -25,6 +26,7 @@ module Network.BitTorrent.Tracker.List
25import Prelude hiding (mapM, foldr) 26import Prelude hiding (mapM, foldr)
26import Control.Applicative 27import Control.Applicative
27import Control.Exception 28import Control.Exception
29import Data.Default
28import Data.List as L (elem, any, filter, null) 30import Data.List as L (elem, any, filter, null)
29import Data.Maybe 31import Data.Maybe
30import Data.Foldable 32import 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.
55instance Default (TrackerList URI) where
56 def = TierList []
57
52instance Functor TrackerList where 58instance 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)