diff options
Diffstat (limited to 'src/Data/Torrent.hs')
-rw-r--r-- | src/Data/Torrent.hs | 8 |
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. | ||
144 | instance 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. |
144 | infoDictionary :: LayoutInfo -> PieceInfo -> Bool -> InfoDict | 148 | infoDictionary :: LayoutInfo -> PieceInfo -> Bool -> InfoDict |
145 | infoDictionary li pinfo private = InfoDict ih li pinfo private | 149 | infoDictionary 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... | ||
348 | instance Default Torrent where | ||
349 | def = nullTorrent def | ||
350 | |||
343 | -- | A simple torrent contains only required fields. | 351 | -- | A simple torrent contains only required fields. |
344 | nullTorrent :: InfoDict -> Torrent | 352 | nullTorrent :: InfoDict -> Torrent |
345 | nullTorrent info = Torrent | 353 | nullTorrent info = Torrent |