dev: hlint: Avoid use of reverse.

Note that this is semantically different, and will produce different
results. In particular, the sort is now stable, i.e. account names with
the same balance will not have their order reversed relative to each
other. In this context there doesn't seem to be a reason to prefer one
order to the other, so I'm making this change.
This commit is contained in:
Stephen Morgan 2021-08-27 22:11:41 +10:00 committed by Simon Michael
parent d248aec313
commit b7bf780c52
2 changed files with 1 additions and 2 deletions

View File

@ -10,7 +10,6 @@
- ignore: {name: "Move brackets to avoid $"}
- ignore: {name: "Redundant $"}
- ignore: {name: "Redundant bracket"}
- ignore: {name: "Avoid reverse"}
- ignore: {name: "Use sortOn"}
- ignore: {name: "Use camelCase"}
- ignore: {name: "Use list comprehension"}

View File

@ -147,7 +147,7 @@ genPie opts (items, _total) = def { _pie_background = solidFillStyle $ opaque $
(samesignitems, sign) = sameSignNonZero items
top n t = topn ++ [other]
where
(topn,rest) = splitAt n $ reverse $ sortBy (comparing snd) t
(topn,rest) = splitAt n $ sortBy (flip $ comparing snd) t
other = ("other", sum $ map snd rest)
num = chart_items_ opts
hue = if sign > 0 then red else green where (red, green) = (0, 110)