From b0d2f2883c9d134b04944d6ec4a4ac15fa516cab Mon Sep 17 00:00:00 2001 From: Sam Truzjan Date: Thu, 6 Feb 2014 06:01:49 +0400 Subject: Add Default instance for Torrent datatype --- src/Data/Torrent/Layout.hs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/Data/Torrent/Layout.hs') 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 import Data.ByteString as BS import Data.ByteString.Base16 as Base16 import Data.ByteString.Char8 as BC +import Data.Default import Data.Foldable as F import Data.List as L import Data.Text as T @@ -222,6 +223,10 @@ instance NFData LayoutInfo where rnf SingleFile {..} = () rnf MultiFile {..} = rnf liFiles +-- | Empty multifile layout. +instance Default LayoutInfo where + def = MultiFile [] "" + getLayoutInfo :: Get LayoutInfo getLayoutInfo = single <|> multi where -- cgit v1.2.3