summaryrefslogtreecommitdiff
path: root/src/Data/Torrent.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Data/Torrent.hs')
-rw-r--r--src/Data/Torrent.hs8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/Data/Torrent.hs b/src/Data/Torrent.hs
index 7d3917f2..7833c261 100644
--- a/src/Data/Torrent.hs
+++ b/src/Data/Torrent.hs
@@ -140,6 +140,10 @@ instance Hashable InfoDict where
140 hashWithSalt = Hashable.hashUsing idInfoHash 140 hashWithSalt = Hashable.hashUsing idInfoHash
141 {-# INLINE hashWithSalt #-} 141 {-# INLINE hashWithSalt #-}
142 142
143-- | Empty info dictionary with zero-length content.
144instance Default InfoDict where
145 def = infoDictionary def def False
146
143-- | Smart constructor: add a info hash to info dictionary. 147-- | Smart constructor: add a info hash to info dictionary.
144infoDictionary :: LayoutInfo -> PieceInfo -> Bool -> InfoDict 148infoDictionary :: LayoutInfo -> PieceInfo -> Bool -> InfoDict
145infoDictionary li pinfo private = InfoDict ih li pinfo private 149infoDictionary li pinfo private = InfoDict ih li pinfo private
@@ -340,6 +344,10 @@ instance Pretty Torrent where
340 "Publisher URL" <:>? ((text . show) <$> tPublisherURL) $$ 344 "Publisher URL" <:>? ((text . show) <$> tPublisherURL) $$
341 "Signature" <:>? ((text . show) <$> tSignature) 345 "Signature" <:>? ((text . show) <$> tSignature)
342 346
347-- | No files, no trackers, no nodes, etc...
348instance Default Torrent where
349 def = nullTorrent def
350
343-- | A simple torrent contains only required fields. 351-- | A simple torrent contains only required fields.
344nullTorrent :: InfoDict -> Torrent 352nullTorrent :: InfoDict -> Torrent
345nullTorrent info = Torrent 353nullTorrent info = Torrent