From ddcbd384fbab2796839083a00e9c22f6dd15f2ce Mon Sep 17 00:00:00 2001 From: Ramakrishnan Muthukrishnan Date: Wed, 11 Feb 2015 21:14:26 +0530 Subject: [PATCH] WIP: Johan Tibbel's haskell style guide compliance. https://github.com/tibbe/haskell-style-guide/blob/master/haskell-style.md --- src/Metainfo.hs | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/src/Metainfo.hs b/src/Metainfo.hs index 6ba7668..22df5f6 100644 --- a/src/Metainfo.hs +++ b/src/Metainfo.hs @@ -6,22 +6,22 @@ import qualified Data.Map as M import Data.Time.Clock -- only single file mode supported for the time being. -data Info = Info { pieceLength :: Integer - , pieces :: BC.ByteString - , private :: Maybe Integer - , name :: String - , lengthInBytes :: Integer - , md5sum :: Maybe String } - deriving (Eq, Show) +data Info = Info { pieceLength :: !Integer + , pieces :: !BC.ByteString + , private :: !(Maybe Integer) + , name :: !String + , lengthInBytes :: !Integer + , md5sum :: !(Maybe String) + } deriving (Eq, Show) -data Metainfo = Metainfo { info :: Info - , announce :: String - , announceList :: Maybe [[String]] - , creationDate :: Maybe String - , comment :: Maybe String - , createdBy :: Maybe String - , encoding :: Maybe String } - deriving (Eq, Show) +data Metainfo = Metainfo { info :: !Info + , announce :: !String + , announceList :: !(Maybe [[String]]) + , creationDate :: !(Maybe String) + , comment :: !(Maybe String) + , createdBy :: !(Maybe String) + , encoding :: !(Maybe String) + } deriving (Eq, Show) mkInfo :: Benc.BVal -> Maybe Info mkInfo (Benc.Bdict m) = let (Benc.Bint pieceLength') = m M.! (Benc.Bstr (BC.pack "piece length")) @@ -35,7 +35,8 @@ mkInfo (Benc.Bdict m) = let (Benc.Bint pieceLength') = m M.! (Benc.Bstr (BC.pack , private = private' , name = BC.unpack name' , lengthInBytes = length' - , md5sum = md5sum' } + , md5sum = md5sum' + } mkInfo _ = Nothing maybeBstrToString :: Maybe Benc.BVal -> Maybe String -- 2.45.2