Hlint: Warning: Use if
This commit is contained in:
parent
96aa730951
commit
4407b6c59d
@ -54,14 +54,10 @@ rstrip = reverse . dropws . reverse
|
|||||||
dropws = dropWhile (`elem` " \t")
|
dropws = dropWhile (`elem` " \t")
|
||||||
|
|
||||||
elideLeft width s =
|
elideLeft width s =
|
||||||
case length s > width of
|
if length s > width then ".." ++ reverse (take (width - 2) $ reverse s) else s
|
||||||
True -> ".." ++ reverse (take (width - 2) $ reverse s)
|
|
||||||
False -> s
|
|
||||||
|
|
||||||
elideRight width s =
|
elideRight width s =
|
||||||
case length s > width of
|
if length s > width then take (width - 2) s ++ ".." else s
|
||||||
True -> take (width - 2) s ++ ".."
|
|
||||||
False -> s
|
|
||||||
|
|
||||||
underline :: String -> String
|
underline :: String -> String
|
||||||
underline s = s' ++ replicate (length s) '-' ++ "\n"
|
underline s = s' ++ replicate (length s) '-' ++ "\n"
|
||||||
|
|||||||
@ -239,9 +239,7 @@ optsToFilterSpec opts args t = FilterSpec {
|
|||||||
,costbasis=CostBasis `elem` opts
|
,costbasis=CostBasis `elem` opts
|
||||||
,acctpats=apats
|
,acctpats=apats
|
||||||
,descpats=dpats
|
,descpats=dpats
|
||||||
,whichdate=case Effective `elem` opts of
|
,whichdate = if Effective `elem` opts then EffectiveDate else ActualDate
|
||||||
True -> EffectiveDate
|
|
||||||
_ -> ActualDate
|
|
||||||
}
|
}
|
||||||
where (apats,dpats) = parsePatternArgs args
|
where (apats,dpats) = parsePatternArgs args
|
||||||
|
|
||||||
|
|||||||
4
Utils.hs
4
Utils.hs
@ -33,9 +33,7 @@ withLedgerDo opts args cmdname cmd = do
|
|||||||
t <- getCurrentLocalTime
|
t <- getCurrentLocalTime
|
||||||
tc <- getClockTime
|
tc <- getClockTime
|
||||||
let go = cmd opts args . filterAndCacheLedgerWithOpts opts args t rawtext . (\rl -> rl{filepath=f,filereadtime=tc})
|
let go = cmd opts args . filterAndCacheLedgerWithOpts opts args t rawtext . (\rl -> rl{filepath=f,filereadtime=tc})
|
||||||
case creating of
|
if creating then go rawLedgerEmpty else (runErrorT . parseLedgerFile t) f >>= either (hPutStrLn stderr) go
|
||||||
True -> go rawLedgerEmpty
|
|
||||||
False -> (runErrorT . parseLedgerFile t) f >>= either (hPutStrLn stderr) go
|
|
||||||
|
|
||||||
-- | Get a Ledger from the given string and options, or raise an error.
|
-- | Get a Ledger from the given string and options, or raise an error.
|
||||||
ledgerFromStringWithOpts :: [Opt] -> [String] -> LocalTime -> String -> IO Ledger
|
ledgerFromStringWithOpts :: [Opt] -> [String] -> LocalTime -> String -> IO Ledger
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user