Hlint: Error: Use unless

This commit is contained in:
marko.kocic 2009-09-22 12:43:30 +00:00
parent 590bf8eeaa
commit 1e6f38eb41

View File

@ -27,7 +27,7 @@ add _ args l
hPutStrLn stderr hPutStrLn stderr
"Enter one or more transactions, which will be added to your ledger file.\n\ "Enter one or more transactions, which will be added to your ledger file.\n\
\To complete a transaction, enter . as account name. To quit, enter control-d." \To complete a transaction, enter . as account name. To quit, enter control-d."
getAndAddTransactions l args `catch` (\e -> if isEOFError e then return () else ioError e) getAndAddTransactions l args `catch` (\e -> unless (isEOFError e) $ ioError e)
-- | Read a number of ledger transactions from the command line, -- | Read a number of ledger transactions from the command line,
-- prompting, validating, displaying and appending them to the ledger -- prompting, validating, displaying and appending them to the ledger
@ -68,7 +68,7 @@ getTransaction l args = do
hPutStrLn stderr $ "\n" ++ nonzerobalanceerror ++ ". Re-enter:" hPutStrLn stderr $ "\n" ++ nonzerobalanceerror ++ ". Re-enter:"
getpostingsandvalidate getpostingsandvalidate
either (const retry) return $ balanceLedgerTransaction t either (const retry) return $ balanceLedgerTransaction t
when (not $ null historymatches) unless (null historymatches)
(do (do
hPutStrLn stderr "Similar transactions found, using the first for defaults:\n" hPutStrLn stderr "Similar transactions found, using the first for defaults:\n"
hPutStr stderr $ concatMap (\(n,t) -> printf "[%3d%%] %s" (round $ n*100 :: Int) (show t)) $ take 3 historymatches) hPutStr stderr $ concatMap (\(n,t) -> printf "[%3d%%] %s" (round $ n*100 :: Int) (show t)) $ take 3 historymatches)