mirror of
https://github.com/simonmichael/hledger.git
synced 2024-09-18 17:57:11 +03:00
cln: hlint: Clean up map-fusion related hlint warnings.
This commit is contained in:
parent
eb6047e81b
commit
3431b1b0d9
@ -34,15 +34,11 @@
|
||||
- ignore: {name: "Redundant <$>"}
|
||||
- ignore: {name: "Use list literal pattern"}
|
||||
- ignore: {name: "Use fewer imports"}
|
||||
- ignore: {name: "Use mapMaybe"}
|
||||
- ignore: {name: "Use intercalate"}
|
||||
- ignore: {name: "Use tuple-section"}
|
||||
- ignore: {name: "Use section"}
|
||||
- ignore: {name: "Use maybe"}
|
||||
- ignore: {name: "Fuse concatMap/map"}
|
||||
- ignore: {name: "Use concatMap"}
|
||||
- ignore: {name: "Redundant bang pattern"}
|
||||
- ignore: {name: "Use zipWith"}
|
||||
- ignore: {name: "Replace case with maybe"}
|
||||
- ignore: {name: "Avoid lambda using `infix`"}
|
||||
- ignore: {name: "Use zip"}
|
||||
|
@ -699,7 +699,7 @@ journalNumberAndTieTransactions = journalTieTransactions . journalNumberTransact
|
||||
|
||||
-- | Number (set the tindex field) this journal's transactions, counting upward from 1.
|
||||
journalNumberTransactions :: Journal -> Journal
|
||||
journalNumberTransactions j@Journal{jtxns=ts} = j{jtxns=map (\(i,t) -> t{tindex=i}) $ zip [1..] ts}
|
||||
journalNumberTransactions j@Journal{jtxns=ts} = j{jtxns=zipWith (\i t -> t{tindex=i}) [1..] ts}
|
||||
|
||||
-- | Tie the knot in all of this journal's transactions, ensuring their postings
|
||||
-- refer to them. This should be done last, after any other transaction-modifying operations.
|
||||
|
@ -33,7 +33,7 @@ prices opts j = do
|
||||
ps = filter (matchesPosting q) $ allPostings j
|
||||
mprices = jpricedirectives j
|
||||
cprices = map (stylePriceDirectiveExceptPrecision styles) $ concatMap postingsPriceDirectivesFromCosts ps
|
||||
icprices = map (stylePriceDirectiveExceptPrecision styles) $ concatMap postingsPriceDirectivesFromCosts $ map (postingTransformAmount $ mapMixedAmount invertPrice) ps
|
||||
icprices = map (stylePriceDirectiveExceptPrecision styles) $ concatMap (postingsPriceDirectivesFromCosts . postingTransformAmount (mapMixedAmount invertPrice)) ps
|
||||
allprices = mprices ++ ifBoolOpt "costs" cprices ++ ifBoolOpt "inverted-costs" icprices
|
||||
mapM_ (T.putStrLn . showPriceDirective) $
|
||||
sortOn pddate $
|
||||
|
@ -126,7 +126,7 @@ diffTxn j t t' =
|
||||
-- original file, other adds transaction to new file with
|
||||
-- suffix .ledger (generated). I.e. move transaction from one file to another.
|
||||
diffs :: [DiffLine Text]
|
||||
diffs = concat . map (traverse showPostingLines . mapDiff) $ D.getDiff (tpostings t) (tpostings t')
|
||||
diffs = concatMap (traverse showPostingLines . mapDiff) $ D.getDiff (tpostings t) (tpostings t')
|
||||
pos@(JournalSourcePos fp (line, line')) -> (pos, diffs) where
|
||||
-- We do diff for original lines vs generated ones. Often leads
|
||||
-- to big diff because of re-format effect.
|
||||
|
@ -229,7 +229,7 @@ backUpFile :: FilePath -> IO ()
|
||||
backUpFile fp = do
|
||||
fs <- safeGetDirectoryContents $ takeDirectory $ fp
|
||||
let (d,f) = splitFileName fp
|
||||
versions = catMaybes $ map (f `backupNumber`) fs
|
||||
versions = mapMaybe (f `backupNumber`) fs
|
||||
next = maximum (0:versions) + 1
|
||||
f' = printf "%s.%d" f next
|
||||
copyFile fp (d </> f')
|
||||
|
Loading…
Reference in New Issue
Block a user