optimize monadic ||

(||) used applicative style runs both conditions rather than short
circuiting. Add an orM that properly short-circuits.
This commit is contained in:
Joey Hess 2012-03-16 12:28:17 -04:00
parent b06336fa3a
commit 771052a85e
4 changed files with 15 additions and 9 deletions

View file

@ -42,7 +42,7 @@ start :: Maybe Utility.Format.Format -> FilePath -> (Key, Backend) -> CommandSta
start format file (key, _) = do
-- only files inAnnex are shown, unless the user has requested
-- others via a limit
whenM (liftM2 (||) limited (inAnnex key)) $
whenM (orM limited (inAnnex key)) $
unlessM (showFullJSON vars) $
case format of
Nothing -> liftIO $ putStrLn file