From: Ramakrishnan Muthukrishnan Date: Wed, 11 Feb 2015 15:44:26 +0000 (+0530) Subject: WIP: Johan Tibbel's haskell style guide compliance. X-Git-Url: https://git.rkrishnan.org/specifications/%5B/%5D%20/%22news.html/index.php?a=commitdiff_plain;h=ddcbd384fbab2796839083a00e9c22f6dd15f2ce;p=functorrent.git WIP: Johan Tibbel's haskell style guide compliance. https://github.com/tibbe/haskell-style-guide/blob/master/haskell-style.md --- 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