Hlint: Error: Redundant do
This commit is contained in:
parent
8fdd28d446
commit
2855fe9e0a
@ -95,7 +95,7 @@ print_ledger_txn debug (baseacct,fieldpositions,rules) record@(_:_:_:_:_:[]) = d
|
||||
putStrLn $ printf "%s%s %s" (fixdate date) (if not (null number) then printf " (%s)" number else "") desc
|
||||
putStrLn $ printf " %-30s %15s" acct (printf "$%s" amount' :: String)
|
||||
putStrLn $ printf " %s\n" baseacct
|
||||
print_ledger_txn True _ record = do
|
||||
print_ledger_txn True _ record =
|
||||
hPutStrLn stderr $ printf "ignoring %s" $ show record
|
||||
print_ledger_txn _ _ _ = return ()
|
||||
|
||||
|
||||
@ -72,7 +72,7 @@ parseLedgerFile t f = liftIO (readFile f) >>= parseLedger t f
|
||||
-- the current (local) time to calculate any unfinished timelog sessions,
|
||||
-- we pass it in for repeatability.
|
||||
parseLedger :: LocalTime -> FilePath -> String -> ErrorT String IO RawLedger
|
||||
parseLedger reftime inname intxt = do
|
||||
parseLedger reftime inname intxt =
|
||||
case runParser ledgerFile emptyCtx inname intxt of
|
||||
Right m -> liftM (rawLedgerConvertTimeLog reftime) $ m `ap` (return rawLedgerEmpty)
|
||||
Left err -> throwError $ show err
|
||||
@ -115,7 +115,7 @@ ledgerInclude = do many1 spacenonewline
|
||||
case runParser ledgerFile outerState filename contents of
|
||||
Right l -> l `catchError` (throwError . (inIncluded ++))
|
||||
Left perr -> throwError $ inIncluded ++ show perr
|
||||
where readFileE outerPos filename = ErrorT $ do liftM Right (readFile filename) `catch` leftError
|
||||
where readFileE outerPos filename = ErrorT $ liftM Right (readFile filename) `catch` leftError
|
||||
where leftError err = return $ Left $ currentPos ++ whileReading ++ show err
|
||||
currentPos = show outerPos
|
||||
whileReading = " reading " ++ show filename ++ ":\n"
|
||||
|
||||
14
Tests.hs
14
Tests.hs
@ -285,7 +285,7 @@ tests = [
|
||||
)
|
||||
]
|
||||
|
||||
,"accountnames" ~: do
|
||||
,"accountnames" ~:
|
||||
accountnames ledger7 `is`
|
||||
["assets","assets:cash","assets:checking","assets:saving","equity","equity:opening balances",
|
||||
"expenses","expenses:food","expenses:food:dining","expenses:phone","expenses:vacation",
|
||||
@ -487,14 +487,14 @@ tests = [
|
||||
Right e' -> (pamount $ last $ ltpostings e')
|
||||
Left _ -> error "should not happen")
|
||||
|
||||
,"cacheLedger" ~: do
|
||||
,"cacheLedger" ~:
|
||||
length (Map.keys $ accountmap $ cacheLedger [] rawledger7) `is` 15
|
||||
|
||||
,"canonicaliseAmounts" ~:
|
||||
"use the greatest precision" ~: do
|
||||
"use the greatest precision" ~:
|
||||
rawLedgerPrecisions (canonicaliseAmounts False $ rawLedgerWithAmounts ["1","2.00"]) `is` [2,2]
|
||||
|
||||
,"commodities" ~: do
|
||||
,"commodities" ~:
|
||||
commodities ledger7 `is` [Commodity {symbol="$", side=L, spaced=False, comma=False, precision=2}]
|
||||
|
||||
,"dateSpanFromOpts" ~: do
|
||||
@ -539,7 +539,7 @@ tests = [
|
||||
[clockin future ""]
|
||||
[printf "%s-%s" futurestr futurestr]
|
||||
|
||||
,"expandAccountNames" ~: do
|
||||
,"expandAccountNames" ~:
|
||||
expandAccountNames ["assets:cash","assets:checking","expenses:vacation"] `is`
|
||||
["assets","assets:cash","assets:checking","expenses","expenses:vacation"]
|
||||
|
||||
@ -623,7 +623,7 @@ tests = [
|
||||
r <- rawLedgerFromString "" -- don't know how to get it from ledgerFile
|
||||
assertBool "ledgerFile parsing an empty file should give an empty ledger" $ null $ ledger_txns r
|
||||
|
||||
,"ledgerHistoricalPrice" ~: do
|
||||
,"ledgerHistoricalPrice" ~:
|
||||
parseWithCtx emptyCtx ledgerHistoricalPrice price1_str `parseis` price1
|
||||
|
||||
,"ledgerTransaction" ~: do
|
||||
@ -642,7 +642,7 @@ tests = [
|
||||
assertBool "ledgeraccountname rejects an empty leading component" (isLeft $ parsewith ledgeraccountname ":b:c")
|
||||
assertBool "ledgeraccountname rejects an empty trailing component" (isLeft $ parsewith ledgeraccountname "a:b:")
|
||||
|
||||
,"ledgerposting" ~: do
|
||||
,"ledgerposting" ~:
|
||||
parseWithCtx emptyCtx ledgerposting rawposting1_str `parseis` rawposting1
|
||||
|
||||
,"parsedate" ~: do
|
||||
|
||||
Loading…
Reference in New Issue
Block a user