diff --git a/Ledger/Utils.hs b/Ledger/Utils.hs index 1263d613d..6591ae313 100644 --- a/Ledger/Utils.hs +++ b/Ledger/Utils.hs @@ -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" diff --git a/Options.hs b/Options.hs index 18665dbd1..44cf9efeb 100644 --- a/Options.hs +++ b/Options.hs @@ -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 diff --git a/Utils.hs b/Utils.hs index 4e9f2fa54..83435bd80 100644 --- a/Utils.hs +++ b/Utils.hs @@ -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