From 48b3ff966060a858e61ff52565f15b71e9bb525b Mon Sep 17 00:00:00 2001 From: Phil de Joux Date: Sat, 7 Feb 2026 07:03:00 -0500 Subject: [PATCH] Follow hlint suggestion: use == - Update hlint --default counts - Follow hlint suggestion: use == - Follow hlint suggestion: redundant maybe - Remove redundant brackets --- .hlint.yaml | 12 +++++------- Cabal/src/Distribution/Simple/Configure.hs | 4 ++-- Cabal/src/Distribution/Simple/SrcDist.hs | 5 +---- cabal-install/src/Distribution/Client/Init/Types.hs | 2 +- 4 files changed, 9 insertions(+), 14 deletions(-) diff --git a/.hlint.yaml b/.hlint.yaml index a4291666ca0..43ea3f9a5c3 100644 --- a/.hlint.yaml +++ b/.hlint.yaml @@ -2,7 +2,7 @@ - ignore: {name: "Avoid NonEmpty.unzip"} # 1 hint - ignore: {name: "Avoid lambda"} # 50 hints - ignore: {name: "Avoid lambda using `infix`"} # 23 hints -- ignore: {name: "Eta reduce"} # 136 hints +- ignore: {name: "Eta reduce"} # 137 hints - ignore: {name: "Evaluate"} # 10 hints - ignore: {name: "Functor law"} # 10 hints - ignore: {name: "Fuse concatMap/map"} # 3 hints @@ -19,27 +19,25 @@ - ignore: {name: "Redundant guard"} # 2 hints - ignore: {name: "Redundant if"} # 6 hints - ignore: {name: "Redundant lambda"} # 19 hints -- ignore: {name: "Redundant maybe"} # 2 hints - ignore: {name: "Redundant multi-way if"} # 1 hint -- ignore: {name: "Redundant return"} # 10 hints +- ignore: {name: "Redundant return"} # 9 hints - ignore: {name: "Replace case with fromMaybe"} # 4 hints - ignore: {name: "Replace case with maybe"} # 10 hints - ignore: {name: "Use $>"} # 5 hints - ignore: {name: "Use ++"} # 4 hints -- ignore: {name: "Use :"} # 28 hints +- ignore: {name: "Use :"} # 29 hints - ignore: {name: "Use <$"} # 2 hints -- ignore: {name: "Use <$>"} # 87 hints +- ignore: {name: "Use <$>"} # 86 hints - ignore: {name: "Use <&>"} # 16 hints - ignore: {name: "Use <=<"} # 4 hints - ignore: {name: "Use =<<"} # 7 hints -- ignore: {name: "Use =="} # 2 hints - ignore: {name: "Use >=>"} # 3 hints - ignore: {name: "Use Down"} # 3 hints - ignore: {name: "Use bimap"} # 7 hints - ignore: {name: "Use camelCase"} # 96 hints - ignore: {name: "Use catMaybes"} # 4 hints - ignore: {name: "Use concatMap"} # 2 hints -- ignore: {name: "Use const"} # 37 hints +- ignore: {name: "Use const"} # 36 hints - ignore: {name: "Use fmap"} # 23 hints - ignore: {name: "Use fold"} # 1 hint - ignore: {name: "Use fromMaybe"} # 5 hints diff --git a/Cabal/src/Distribution/Simple/Configure.hs b/Cabal/src/Distribution/Simple/Configure.hs index 30a1cbb3db4..8d3f91e84b6 100644 --- a/Cabal/src/Distribution/Simple/Configure.hs +++ b/Cabal/src/Distribution/Simple/Configure.hs @@ -2836,7 +2836,7 @@ checkRelocatable verbosity pkg lbi = -- Check if the Compiler support relocatable builds checkCompiler = - unless (compilerFlavor comp `elem` [GHC]) $ + unless (compilerFlavor comp == GHC) $ dieWithException verbosity $ NoCompilerSupport (show comp) where @@ -2877,7 +2877,7 @@ checkRelocatable verbosity pkg lbi = traverse_ (doCheck $ getSymbolicPath pkgr) ipkgs where doCheck pkgr ipkg - | maybe False (== pkgr) (IPI.pkgRoot ipkg) = + | Just pkgr == IPI.pkgRoot ipkg = for_ (IPI.libraryDirs ipkg) $ \libdir -> do -- When @prefix@ is not under @pkgroot@, -- @shortRelativePath prefix pkgroot@ will return a path with diff --git a/Cabal/src/Distribution/Simple/SrcDist.hs b/Cabal/src/Distribution/Simple/SrcDist.hs index c5157dfd308..5ba73f0247f 100644 --- a/Cabal/src/Distribution/Simple/SrcDist.hs +++ b/Cabal/src/Distribution/Simple/SrcDist.hs @@ -513,10 +513,7 @@ createArchive verbosity pkg_descr tmpDir targetPref = do let tarBallFilePath = targetPref tarBallName pkg_descr <.> "tar.gz" (tarProg, _) <- requireProgram verbosity tarProgram defaultProgramDb let formatOptSupported = - maybe False (== "YES") $ - Map.lookup - "Supports --format" - (programProperties tarProg) + Just "YES" == Map.lookup "Supports --format" (programProperties tarProg) runProgram verbosity tarProg $ -- Hmm: I could well be skating on thinner ice here by using the -C option -- (=> seems to be supported at least by GNU and *BSD tar) [The diff --git a/cabal-install/src/Distribution/Client/Init/Types.hs b/cabal-install/src/Distribution/Client/Init/Types.hs index fedae63f657..5e07e601773 100644 --- a/cabal-install/src/Distribution/Client/Init/Types.hs +++ b/cabal-install/src/Distribution/Client/Init/Types.hs @@ -501,7 +501,7 @@ checkInvalidPath :: String -> a -> PurePrompt a checkInvalidPath path act = -- The check below is done this way so it's easier to append -- more invalid paths in the future, if necessary - if path `elem` ["."] + if path == "." then throwPrompt $ BreakException $ "Invalid path: " ++ path else return act