nukes another 15 lines thanks to ifM
This commit is contained in:
parent
ff8b6c1bab
commit
c0c9991c9f
6 changed files with 57 additions and 74 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue