diff options
author | Sam Truzjan <pxqr.sta@gmail.com> | 2014-02-06 06:01:49 +0400 |
---|---|---|
committer | Sam Truzjan <pxqr.sta@gmail.com> | 2014-02-06 06:01:49 +0400 |
commit | b0d2f2883c9d134b04944d6ec4a4ac15fa516cab (patch) | |
tree | 0af3ec4bbcbc5b6e766b549739d13da9294f7413 /src/Data/Torrent/Layout.hs | |
parent | 9af46d4e657bce0a343c7ca0dfacad6696bbf503 (diff) |
Add Default instance for Torrent datatype
Diffstat (limited to 'src/Data/Torrent/Layout.hs')
-rw-r--r-- | src/Data/Torrent/Layout.hs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/Data/Torrent/Layout.hs b/src/Data/Torrent/Layout.hs index a4b55b3d..ef8d45eb 100644 --- a/src/Data/Torrent/Layout.hs +++ b/src/Data/Torrent/Layout.hs | |||
@@ -71,6 +71,7 @@ import Data.BEncode.Types | |||
71 | import Data.ByteString as BS | 71 | import Data.ByteString as BS |
72 | import Data.ByteString.Base16 as Base16 | 72 | import Data.ByteString.Base16 as Base16 |
73 | import Data.ByteString.Char8 as BC | 73 | import Data.ByteString.Char8 as BC |
74 | import Data.Default | ||
74 | import Data.Foldable as F | 75 | import Data.Foldable as F |
75 | import Data.List as L | 76 | import Data.List as L |
76 | import Data.Text as T | 77 | import Data.Text as T |
@@ -222,6 +223,10 @@ instance NFData LayoutInfo where | |||
222 | rnf SingleFile {..} = () | 223 | rnf SingleFile {..} = () |
223 | rnf MultiFile {..} = rnf liFiles | 224 | rnf MultiFile {..} = rnf liFiles |
224 | 225 | ||
226 | -- | Empty multifile layout. | ||
227 | instance Default LayoutInfo where | ||
228 | def = MultiFile [] "" | ||
229 | |||
225 | getLayoutInfo :: Get LayoutInfo | 230 | getLayoutInfo :: Get LayoutInfo |
226 | getLayoutInfo = single <|> multi | 231 | getLayoutInfo = single <|> multi |
227 | where | 232 | where |