summaryrefslogtreecommitdiff
path: root/Remote/Directory.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-03-15 20:39:25 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-03-15 20:39:25 -0400
commitc0c9991c9f5322aef05f4c97d2c3f3bdc3101e46 (patch)
tree9cdd4f7913659329283e8d909fa7c4f98cc567f0 /Remote/Directory.hs
parentff8b6c1bab519f243b67219cc2b43d037b3fa4e2 (diff)
nukes another 15 lines thanks to ifM
Diffstat (limited to 'Remote/Directory.hs')
-rw-r--r--Remote/Directory.hs12
1 files changed, 3 insertions, 9 deletions
diff --git a/Remote/Directory.hs b/Remote/Directory.hs
index 80c45a691..ecbf511d6 100644
--- a/Remote/Directory.hs
+++ b/Remote/Directory.hs
@@ -100,11 +100,7 @@ withCheckedFiles _ _ [] _ _ = return False
withCheckedFiles check Nothing d k a = go $ locations d k
where
go [] = return False
- go (f:fs) = do
- use <- check f
- if use
- then a [f]
- else go fs
+ go (f:fs) = ifM (check f) ( a [f] , go fs )
withCheckedFiles check (Just _) d k a = go $ locations d k
where
go [] = return False
@@ -115,10 +111,8 @@ withCheckedFiles check (Just _) d k a = go $ locations d k
then do
count <- readcount chunkcount
let chunks = take count $ chunkStream f
- ok <- all id <$> mapM check chunks
- if ok
- then a chunks
- else return False
+ ifM (all id <$> mapM check chunks)
+ ( a chunks , return False )
else go fs
readcount f = fromMaybe (error $ "cannot parse " ++ f)
. (readish :: String -> Maybe Int)