From: Ramakrishnan Muthukrishnan Date: Thu, 5 Feb 2015 01:09:12 +0000 (+0530) Subject: typos and correct module namespacing X-Git-Url: https://git.rkrishnan.org/%5B/%5D%20/uri/schema.xhtml?a=commitdiff_plain;h=9dc76f02d17446166d7ac6849125ceb6449980fd;p=functorrent.git typos and correct module namespacing --- diff --git a/src/Metainfo.hs b/src/Metainfo.hs index c609123..b07b3f7 100644 --- a/src/Metainfo.hs +++ b/src/Metainfo.hs @@ -14,7 +14,7 @@ data Info = Info { pieceLength :: Integer , md5sum :: Maybe String } deriving (Eq) -data Metainfo = MetaInfo { info :: Info +data Metainfo = Metainfo { info :: Info , announce :: String , announceList :: Maybe [[String]] , creationDate :: Maybe UTCTime @@ -23,19 +23,19 @@ data Metainfo = MetaInfo { info :: Info , encoding :: Maybe String } deriving (Eq) -mkMetaInfo :: Benv.BVal -> Maybe MetaInfo -mkMetaInfo (Bdict m) = let info = mkInfo (m ! (Bstr (BC.pack "info"))) - announce = m M.! (Bstr (BC.pack "announce")) - announceList = M.lookup (Bstr (BC.pack "announce list")) m - creationDate = M.lookup (Bstr (BC.pack "creation date")) m - comment = M.lookup (Bstr (BC.pack "comment")) m - createdBy = M.lookup (Bstr (BC.pack "created by")) m - encoding = M.lookup (Bstr (BC.pack "encoding")) m - in Just MetaInfo { info = info - , announce = announce - , announceList = announceList - , creationDate = creationDate - , comment = comment - , createdBy = createdBy - , encoding = encoding } +mkMetaInfo :: Benc.BVal -> Maybe Metainfo +mkMetaInfo (Benc.Bdict m) = let info = mkInfo (m M.! (Benc.Bstr (BC.pack "info"))) + announce = m M.! (Benc.Bstr (BC.pack "announce")) + announceList = M.lookup (Benc.Bstr (BC.pack "announce list")) m + creationDate = M.lookup (Benc.Bstr (BC.pack "creation date")) m + comment = M.lookup (Benc.Bstr (BC.pack "comment")) m + createdBy = M.lookup (Benc.Bstr (BC.pack "created by")) m + encoding = M.lookup (Benc.Bstr (BC.pack "encoding")) m + in Just Metainfo { info = info + , announce = announce + , announceList = announceList + , creationDate = creationDate + , comment = comment + , createdBy = createdBy + , encoding = encoding } mkMetaInfo _ = Nothing