projects
/
functorrent.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
cb47bff
)
Minor refactor maybeBstrToString
author
Jaseem Abid
<jaseemabid@gmail.com>
Mon, 30 Mar 2015 16:30:13 +0000
(22:00 +0530)
committer
Jaseem Abid
<jaseemabid@gmail.com>
Mon, 30 Mar 2015 16:30:13 +0000
(22:00 +0530)
Makes the function total. Also, this looks a lot like fmap!
src/FuncTorrent/Metainfo.hs
patch
|
blob
|
history
diff --git
a/src/FuncTorrent/Metainfo.hs
b/src/FuncTorrent/Metainfo.hs
index 216fd2414231d2731376fd50a700d204695f2109..d6f2cf745f56e6e6438eff9a4ee9968a206323f9 100644
(file)
--- a/
src/FuncTorrent/Metainfo.hs
+++ b/
src/FuncTorrent/Metainfo.hs
@@
-49,9
+49,8
@@
mkInfo (Bdict m) = let (Bint pieceLength') = m ! "piece length"
mkInfo _ = Nothing
maybeBstrToString :: Maybe BVal -> Maybe String
-maybeBstrToString Nothing = Nothing
-maybeBstrToString (Just s) = let (Bstr bs) = s
- in Just (unpack bs)
+maybeBstrToString (Just (Bstr bs)) = Just $ unpack bs
+maybeBstrToString _ = Nothing
mkMetaInfo :: BVal -> Maybe Metainfo
mkMetaInfo (Bdict m) = let (Just info') = mkInfo $ m ! "info"