cln: hlint: Clean up map-fusion related hlint warnings.

This commit is contained in:
Stephen Morgan 2021-08-16 13:43:28 +10:00 committed by Simon Michael
parent eb6047e81b
commit 3431b1b0d9
5 changed files with 4 additions and 8 deletions

View File

@ -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"}

View File

@ -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.

View File

@ -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 $

View File

@ -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.

View File

@ -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')