Hlint: Warning: Use if

This commit is contained in:
marko.kocic 2009-09-23 09:29:31 +00:00
parent 96aa730951
commit 4407b6c59d
3 changed files with 4 additions and 12 deletions

View File

@ -54,14 +54,10 @@ rstrip = reverse . dropws . reverse
dropws = dropWhile (`elem` " \t")
elideLeft width s =
case length s > width of
True -> ".." ++ reverse (take (width - 2) $ reverse s)
False -> s
if length s > width then ".." ++ reverse (take (width - 2) $ reverse s) else s
elideRight width s =
case length s > width of
True -> take (width - 2) s ++ ".."
False -> s
if length s > width then take (width - 2) s ++ ".." else s
underline :: String -> String
underline s = s' ++ replicate (length s) '-' ++ "\n"

View File

@ -239,9 +239,7 @@ optsToFilterSpec opts args t = FilterSpec {
,costbasis=CostBasis `elem` opts
,acctpats=apats
,descpats=dpats
,whichdate=case Effective `elem` opts of
True -> EffectiveDate
_ -> ActualDate
,whichdate = if Effective `elem` opts then EffectiveDate else ActualDate
}
where (apats,dpats) = parsePatternArgs args

View File

@ -33,9 +33,7 @@ withLedgerDo opts args cmdname cmd = do
t <- getCurrentLocalTime
tc <- getClockTime
let go = cmd opts args . filterAndCacheLedgerWithOpts opts args t rawtext . (\rl -> rl{filepath=f,filereadtime=tc})
case creating of
True -> go rawLedgerEmpty
False -> (runErrorT . parseLedgerFile t) f >>= either (hPutStrLn stderr) go
if creating then go rawLedgerEmpty else (runErrorT . parseLedgerFile t) f >>= either (hPutStrLn stderr) go
-- | Get a Ledger from the given string and options, or raise an error.
ledgerFromStringWithOpts :: [Opt] -> [String] -> LocalTime -> String -> IO Ledger