cln: hlint: Clean up == and elem related hlint warnings.

This commit is contained in:
Stephen Morgan 2021-08-16 14:09:17 +10:00 committed by Simon Michael
parent 82872d261a
commit e13239386f
12 changed files with 13 additions and 19 deletions

View File

@ -11,7 +11,6 @@
- ignore: {name: "Use list literal"}
- ignore: {name: "Move brackets to avoid $"}
- ignore: {name: "Redundant $"}
- ignore: {name: "Use notElem"}
- ignore: {name: "Use <$>"}
- ignore: {name: "Redundant bracket"}
- ignore: {name: "Avoid reverse"}
@ -19,7 +18,6 @@
- ignore: {name: "Use $>"}
- ignore: {name: "Use unless"}
- ignore: {name: "Use any"}
- ignore: {name: "Use /="}
- ignore: {name: "Use =<<"}
- ignore: {name: "Use fmap"}
- ignore: {name: "Use <&>"}
@ -43,7 +41,6 @@
- ignore: {name: "Use replicate"}
- ignore: {name: "Use void"}
- ignore: {name: "Use elemIndex"}
- ignore: {name: "Use =="}
- ignore: {name: "Use lambda-case"}
- ignore: {name: "Replace case with fromMaybe"}

View File

@ -681,7 +681,7 @@ main = do
maybePrependPackage s = maybe s (++("-"++s)) mpkg
toTag = maybePrependPackage
isOldRelease rev = isReleaseVersion rev && toTag rev `elem` tags
isNewRelease rev = isReleaseVersion rev && not (toTag rev `elem` tags)
isNewRelease rev = isReleaseVersion rev && toTag rev `notElem` tags
-- git revision corresponding to the changelog version:
-- a hash (a3f19c15), package release tag (hledger-ui-1.20), or project release tag (1.20)
lastrev

View File

@ -130,7 +130,7 @@ postingSetDate md p@Posting{ptags,pcomment} = p{pdate=md, ptags=ptags'', pcommen
Nothing -> ptags'
Just d -> ptags'++[("date", T.pack $ show d)]
where
ptags' = filter (not.(=="date").fst) ptags
ptags' = filter ((/="date").fst) ptags
pcomment' = case md of
Nothing -> pcomment

View File

@ -409,7 +409,7 @@ journalAccountTypeQuery atypes fallbackregex Journal{jdeclaredaccounttypes} =
differentlytypedsubs = concat
[subs | (t,bs) <- M.toList jdeclaredaccounttypes
, not $ t `elem` atypes
, t `notElem` atypes
, let subs = [b | b <- bs, any (`isAccountNamePrefixOf` b) as]
]

View File

@ -342,7 +342,7 @@ pricesShortestPath start end edges =
| e <- nextedges
, let path' = dbgpath "trying" $ path ++ [e] -- PERF prepend ?
, let pathnodes' = mpto e : pathnodes
, let remainingedges' = [r | r <- remainingedges, not $ mpto r `elem` pathnodes' ]
, let remainingedges' = [r | r <- remainingedges, mpto r `notElem` pathnodes' ]
]
-- debug helpers

View File

@ -202,7 +202,7 @@ useColorOnHandle h = unsafePerformIO $ do
let coloroption = colorOption
return $ and [
not no_color
,not $ coloroption `elem` ["never","no"]
,coloroption `notElem` ["never","no"]
,coloroption `elem` ["always","yes"] || supports_color
]
@ -240,7 +240,7 @@ colorOption =
-- {-# OPTIONS_GHC -fno-cse #-}
-- {-# NOINLINE hasOutputFile #-}
hasOutputFile :: Bool
hasOutputFile = not $ outputFileOption `elem` [Nothing, Just "-"]
hasOutputFile = outputFileOption `notElem` [Nothing, Just "-"]
-- Keep synced with output-file flag definition in hledger:CliOptions.
-- Avoid using dbg*, pshow etc. in this function (infinite loop).

View File

@ -265,7 +265,7 @@ asHandle ui0@UIState{
VtyEvent (EvKey (KChar 'q') []) -> halt ui
-- EvKey (KChar 'l') [MCtrl] -> do
VtyEvent (EvKey KEsc []) -> continue $ resetScreens d ui
VtyEvent (EvKey (KChar c) []) | c `elem` ['?'] -> continue $ setMode Help ui
VtyEvent (EvKey (KChar c) []) | c == '?' -> continue $ setMode Help ui
-- XXX AppEvents currently handled only in Normal mode
-- XXX be sure we don't leave unconsumed events piling up
AppEvent (DateChange old _) | isStandardPeriod p && p `periodContainsDate` old ->

View File

@ -310,7 +310,7 @@ rsHandle ui@UIState{
case ev of
VtyEvent (EvKey (KChar 'q') []) -> halt ui
VtyEvent (EvKey KEsc []) -> continue $ resetScreens d ui
VtyEvent (EvKey (KChar c) []) | c `elem` ['?'] -> continue $ setMode Help ui
VtyEvent (EvKey (KChar c) []) | c == '?' -> continue $ setMode Help ui
AppEvent (DateChange old _) | isStandardPeriod p && p `periodContainsDate` old ->
continue $ regenerateScreens j d $ setReportPeriod (DayPeriod d) ui
where

View File

@ -154,7 +154,7 @@ tsHandle ui@UIState{aScreen=TransactionScreen{tsTransaction=(i,t), tsTransaction
case ev of
VtyEvent (EvKey (KChar 'q') []) -> halt ui
VtyEvent (EvKey KEsc []) -> continue $ resetScreens d ui
VtyEvent (EvKey (KChar c) []) | c `elem` ['?'] -> continue $ setMode Help ui
VtyEvent (EvKey (KChar c) []) | c == '?' -> continue $ setMode Help ui
VtyEvent (EvKey (KChar 'E') []) -> suspendAndResume $ void (runEditor pos f) >> uiReloadJournalIfChanged copts d j ui
where
(pos,f) = case tsourcepos t of

View File

@ -88,8 +88,8 @@ checkUIOpts :: UIOpts -> UIOpts
checkUIOpts opts =
either usageError (const opts) $ do
case maybestringopt "theme" $ rawopts_ $ cliopts_ opts of
Just t | not $ elem t themeNames -> Left $ "invalid theme name: "++t
_ -> Right ()
Just t | t `notElem` themeNames -> Left $ "invalid theme name: "++t
_ -> Right ()
-- XXX some refactoring seems due
getHledgerUIOpts :: IO UIOpts

View File

@ -245,10 +245,7 @@ shouldShowSidebar = do
msidebarcookie <- lookup "showsidebar" . reqCookies <$> getRequest
return $
let disablevalues = ["","0"]
in maybe
(not $ msidebarcookie `elem` map Just disablevalues)
(not . (`elem` disablevalues))
msidebarparam
in maybe True (`notElem` disablevalues) $ msidebarparam <|> msidebarcookie
-- | Update our copy of the journal if the file changed. If there is an
-- error while reloading, keep the old one and return the error, and set a

View File

@ -188,7 +188,7 @@ main = do
-- addon commands
| isExternalCommand = do
let externalargs = argsbeforecmd ++ filter (not.(=="--")) argsaftercmd
let externalargs = argsbeforecmd ++ filter (/="--") argsaftercmd
let shellcmd = printf "%s-%s %s" progname cmd (unwords' externalargs) :: String
dbgIO "external command selected" cmd
dbgIO "external command arguments" (map quoteIfNeeded externalargs)