Skip to content

Commit 0574d4a

Browse files
committed
Follow hlint suggestion: Use infix for elem
1 parent 6ef8193 commit 0574d4a

File tree

8 files changed

+11
-12
lines changed

8 files changed

+11
-12
lines changed

.hlint.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@
4545
- ignore: {name: "Use fold"} # 1 hint
4646
- ignore: {name: "Use fromMaybe"} # 5 hints
4747
- ignore: {name: "Use fst"} # 2 hints
48-
- ignore: {name: "Use infix"} # 27 hints
4948
- ignore: {name: "Use lambda-case"} # 58 hints
5049
- ignore: {name: "Use list comprehension"} # 19 hints
5150
- ignore: {name: "Use list literal"} # 3 hints

Cabal/src/Distribution/PackageDescription/Check.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,7 @@ checkPackageDescription
423423
-- But it is OK for executables to have the same name.
424424
nsubs <- asksCM (pnSubLibs . ccNames)
425425
checkP
426-
(elem (prettyShow pn) (prettyShow <$> nsubs))
426+
(prettyShow pn `elem` (prettyShow <$> nsubs))
427427
(PackageBuildImpossible $ IllegalLibraryName pn)
428428

429429
-- § Fields check.

Cabal/src/Distribution/PackageDescription/Check/Conditional.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ annotateCondTree fs ta (CondNode a c bs) =
9292
-- \*off* by default.
9393
isPkgFlagCond :: Condition ConfVar -> Bool
9494
isPkgFlagCond (Lit _) = False
95-
isPkgFlagCond (Var (PackageFlag f)) = elem f defOffFlags
95+
isPkgFlagCond (Var (PackageFlag f)) = f `elem` defOffFlags
9696
isPkgFlagCond (Var _) = False
9797
isPkgFlagCond (CNot cn) = not (isPkgFlagCond cn)
9898
isPkgFlagCond (CAnd ca cb) = isPkgFlagCond ca || isPkgFlagCond cb

Cabal/src/Distribution/PackageDescription/Check/Target.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -692,7 +692,7 @@ checkAutogenModules ams bi = do
692692
-- PackageBuildImpossible and not merely PackageDistInexcusable.
693693
checkSpecVer
694694
CabalSpecV3_12
695-
(elem autoInfoModuleName allModsForAuto)
695+
(autoInfoModuleName `elem` allModsForAuto)
696696
(PackageBuildImpossible CVAutogenPackageInfoGuard)
697697
where
698698
allModsForAuto :: [ModuleName]

Cabal/src/Distribution/Simple/GHC/Build/Link.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -726,7 +726,7 @@ extractRtsInfo lbi =
726726
-- threaded RTS. This is used to determine which RTS to link against when
727727
-- building a foreign library with a GHC without support for @-flink-rts@.
728728
hasThreaded :: BuildInfo -> Bool
729-
hasThreaded bi = elem "-threaded" ghc
729+
hasThreaded bi = "-threaded" `elem` ghc
730730
where
731731
PerCompilerFlavor ghc _ = options bi
732732

Cabal/src/Distribution/Simple/GHC/Build/Utils.hs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,15 +76,15 @@ withDynFLib flib =
7676

7777
-- | Is this file a C++ source file, i.e. ends with .cpp, .cxx, or .c++?
7878
isCxx :: FilePath -> Bool
79-
isCxx fp = elem (takeExtension fp) [".cpp", ".cxx", ".c++"]
79+
isCxx fp = takeExtension fp `elem` [".cpp", ".cxx", ".c++"]
8080

8181
-- | Is this a C source file, i.e. ends with .c?
8282
isC :: FilePath -> Bool
83-
isC fp = elem (takeExtension fp) [".c"]
83+
isC fp = takeExtension fp `elem` [".c"]
8484

8585
-- | FilePath has a Haskell extension: .hs or .lhs
8686
isHaskell :: FilePath -> Bool
87-
isHaskell fp = elem (takeExtension fp) [".hs", ".lhs"]
87+
isHaskell fp = takeExtension fp `elem` [".hs", ".lhs"]
8888

8989
-- | Returns True if the modification date of the given source file is newer than
9090
-- the object file we last compiled for it, or if no object file exists yet.

Cabal/src/Distribution/Simple/GHCJS.hs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1243,11 +1243,11 @@ gbuildSources verbosity mbWorkDir pkgId specVer tmpDir bm =
12431243
}
12441244

12451245
isCxx :: FilePath -> Bool
1246-
isCxx fp = elem (takeExtension fp) [".cpp", ".cxx", ".c++"]
1246+
isCxx fp = takeExtension fp `elem` [".cpp", ".cxx", ".c++"]
12471247

12481248
-- | FilePath has a Haskell extension: .hs or .lhs
12491249
isHaskell :: FilePath -> Bool
1250-
isHaskell fp = elem (takeExtension fp) [".hs", ".lhs"]
1250+
isHaskell fp = takeExtension fp `elem` [".hs", ".lhs"]
12511251

12521252
-- | Generic build function. See comment for 'GBuildMode'.
12531253
gbuild
@@ -1787,7 +1787,7 @@ popThreadedFlag bi =
17871787
PerCompilerFlavor (filter p ghc) ghcjs
17881788

17891789
hasThreaded :: PerCompilerFlavor [String] -> Bool
1790-
hasThreaded (PerCompilerFlavor ghc _) = elem "-threaded" ghc
1790+
hasThreaded (PerCompilerFlavor ghc _) = "-threaded" `elem` ghc
17911791

17921792
-- | Extracts a String representing a hash of the ABI of a built
17931793
-- library. It can fail if the library has not yet been built.

cabal-install/src/Distribution/Client/Types/AllowNewer.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ isRelaxDeps RelaxDepsAll = True
214214
-- | A smarter 'RelaxedDepsSome', @*:*@ is the same as @all@.
215215
mkRelaxDepSome :: [RelaxedDep] -> RelaxDeps
216216
mkRelaxDepSome xs
217-
| elem (RelaxedDep RelaxDepScopeAll RelaxDepModNone RelaxDepSubjectAll) xs =
217+
| RelaxedDep RelaxDepScopeAll RelaxDepModNone RelaxDepSubjectAll `elem` xs =
218218
RelaxDepsAll
219219
| otherwise =
220220
RelaxDepsSome xs

0 commit comments

Comments
 (0)