Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .hlint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
- ignore: {name: "Hoist not"} # 16 hints
- ignore: {name: "Move filter"} # 4 hints
- ignore: {name: "Redundant $!"} # 1 hint
- ignore: {name: "Redundant <$>"} # 17 hints
- ignore: {name: "Redundant bracket"} # 257 hints
- ignore: {name: "Redundant guard"} # 2 hints
- ignore: {name: "Redundant if"} # 6 hints
Expand Down
3 changes: 1 addition & 2 deletions Cabal-syntax/src/Distribution/Types/CondTree.hs
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,7 @@ traverseCondTreeV f (CondNode a ifs) =
-- | @@Traversal@@ for the data
traverseCondBranchA :: L.Traversal (CondBranch v a) (CondBranch v b) a b
traverseCondBranchA f (CondBranch cnd t me) =
CondBranch
<$> pure cnd
pure (CondBranch cnd)
<*> traverseCondTreeA f t
<*> traverse (traverseCondTreeA f) me

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,7 @@ allCondTrees
-> GenericPackageDescription
-> f GenericPackageDescription
allCondTrees f (GenericPackageDescription p v a1 x1 x2 x3 x4 x5 x6) =
GenericPackageDescription
<$> pure p
pure (GenericPackageDescription p)
<*> pure v
<*> pure a1
<*> traverse f x1
Expand Down
2 changes: 1 addition & 1 deletion Cabal-syntax/src/Distribution/Types/LegacyExeDependency.hs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ instance Parsec LegacyExeDependency where
verRange <- parsecMaybeQuoted parsec <|> pure anyVersion
pure $ LegacyExeDependency name verRange
where
nameP = intercalate "-" <$> toList <$> P.sepByNonEmpty component (P.char '-')
nameP = intercalate "-" . toList <$> P.sepByNonEmpty component (P.char '-')
component = do
cs <- P.munch1 (\c -> isAlphaNum c || c == '+' || c == '_')
if all isDigit cs then fail "invalid component" else return cs
2 changes: 1 addition & 1 deletion Cabal-syntax/src/Distribution/Types/Version.hs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ instance Pretty Version where
)

instance Parsec Version where
parsec = mkVersion <$> toList <$> P.sepByNonEmpty versionDigitParser (P.char '.') <* tags
parsec = (mkVersion . toList <$> P.sepByNonEmpty versionDigitParser (P.char '.')) <* tags
where
tags = do
ts <- many $ P.char '-' *> some (P.satisfy isAlphaNum)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,7 @@ versionRangeParser digitParser csv = expr

-- a plain version without tags or wildcards
verPlain :: CabalParsing m => m Version
verPlain = mkVersion <$> toList <$> P.sepByNonEmpty digitParser (P.char '.')
verPlain = mkVersion . toList <$> P.sepByNonEmpty digitParser (P.char '.')

-- either wildcard or normal version
verOrWild :: CabalParsing m => m (Bool, Version)
Expand Down
2 changes: 1 addition & 1 deletion Cabal/src/Distribution/Compat/ResponseFile.hs
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ expandResponse = go recursionLimit "."
expand _n _dir x = return [x]

readRecursively :: Int -> FilePath -> IO [String]
readRecursively n f = go (n - 1) (takeDirectory f) =<< unescapeArgs <$> readFile f
readRecursively n f = go (n - 1) (takeDirectory f) . unescapeArgs =<< readFile f
7 changes: 1 addition & 6 deletions Cabal/src/Distribution/Simple/GHC.hs
Original file line number Diff line number Diff line change
Expand Up @@ -237,12 +237,7 @@ configureCompiler verbosity hcPath conf0 = do
-- In this example, @AbiTag@ is "inplace".
compilerAbiTag :: AbiTag
compilerAbiTag =
maybe
NoAbiTag
AbiTag
( dropWhile (== '-') . stripCommonPrefix (prettyShow compilerId)
<$> projectUnitId
)
maybe NoAbiTag (AbiTag . dropWhile (== '-') . stripCommonPrefix (prettyShow compilerId)) projectUnitId

wiredInUnitIds = do
ghcInternalUnitId <- Map.lookup "ghc-internal Unit Id" ghcInfoMap
Expand Down
8 changes: 2 additions & 6 deletions cabal-install/src/Distribution/Client/CmdListBin.hs
Original file line number Diff line number Diff line change
Expand Up @@ -377,12 +377,8 @@ renderListBinProblem (TargetProblemMatchesMultiple targetSelector targets) =
++ renderTargetSelector targetSelector
++ " which includes "
++ renderListCommaAnd
( ("the " ++)
<$> showComponentName
<$> availableTargetComponentName
<$> foldMap
(`filterTargetsKind` targets)
[ExeKind, TestKind, BenchKind]
( (("the " ++) <$> showComponentName) . availableTargetComponentName
<$> foldMap (`filterTargetsKind` targets) [ExeKind, TestKind, BenchKind]
)
++ "."
renderListBinProblem (TargetProblemMultipleTargets selectorMap) =
Expand Down
4 changes: 1 addition & 3 deletions cabal-install/src/Distribution/Client/CmdRun.hs
Original file line number Diff line number Diff line change
Expand Up @@ -556,9 +556,7 @@ renderRunProblem (TargetProblemMatchesMultiple targetSelector targets) =
<$> zip
["executables", "test-suites", "benchmarks"]
( filter (not . null) . map sortNub $
map (componentNameRaw . availableTargetComponentName)
<$> (`filterTargetsKind` targets)
<$> [ExeKind, TestKind, BenchKind]
(map (componentNameRaw . availableTargetComponentName) . (`filterTargetsKind` targets) <$> [ExeKind, TestKind, BenchKind])
)
)
renderRunProblem (TargetProblemMultipleTargets selectorMap) =
Expand Down
2 changes: 1 addition & 1 deletion cabal-install/src/Distribution/Client/Init/Utils.hs
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ retrieveModuleImports m = do
-- | Given a module, retrieve all of its language pragmas
retrieveModuleExtensions :: Interactive m => FilePath -> m [Extension]
retrieveModuleExtensions m = do
catMaybes <$> map (simpleParsec . trim) . grabModuleExtensions <$> readFile m
mapMaybe (simpleParsec . trim) . grabModuleExtensions <$> readFile m
where
stop c = (c /= '\n') && (c /= ' ') && (c /= ',') && (c /= '#')

Expand Down
2 changes: 1 addition & 1 deletion cabal-install/src/Distribution/Client/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ main args = do
-- for more information.
let (args0, args1) = break (== "--") args

mainWorker =<< (++ args1) <$> expandResponse args0
mainWorker . (++ args1) =<< expandResponse args0

-- | Check whether assertions are enabled and print a warning in that case.
warnIfAssertionsAreEnabled :: IO ()
Expand Down
3 changes: 1 addition & 2 deletions cabal-install/src/Distribution/Client/ProjectConfig.hs
Original file line number Diff line number Diff line change
Expand Up @@ -612,8 +612,7 @@ findProjectRoot verbosity mprojectDir mprojectFile = do

getProjectRootUsability file >>= \case
ProjectRootUsabilityPresentAndUsable ->
uncurry projectRoot
=<< first dropTrailingPathSeparator . splitFileName <$> canonicalizePath file
uncurry projectRoot . first dropTrailingPathSeparator . splitFileName =<< canonicalizePath file
ProjectRootUsabilityNotPresent ->
left (BadProjectRootExplicitFileNotFound file)
ProjectRootUsabilityPresentAndUnusable ->
Expand Down
3 changes: 1 addition & 2 deletions cabal-install/src/Distribution/Client/SetupWrapper.hs
Original file line number Diff line number Diff line change
Expand Up @@ -404,8 +404,7 @@ getSetup verbosity options mpkg = do
where
mbWorkDir = useWorkingDir options
getPkg =
(relativeSymbolicPath <$> tryFindPackageDesc verbosity mbWorkDir)
>>= readGenericPackageDescription verbosity mbWorkDir
(tryFindPackageDesc verbosity mbWorkDir >>= readGenericPackageDescription verbosity mbWorkDir . relativeSymbolicPath)
>>= return . packageDescription

-- | Decide if we're going to be able to do a direct internal call to the
Expand Down
3 changes: 1 addition & 2 deletions cabal-install/src/Distribution/Client/Utils/Parsec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,7 @@ instance (Newtype a b, Sep sep, Pretty b) => Pretty (NubList' sep b a) where

remoteRepoGrammar :: RepoName -> ParsecFieldGrammar RemoteRepo RemoteRepo
remoteRepoGrammar name =
RemoteRepo
<$> pure name
pure (RemoteRepo name)
<*> uniqueFieldAla "url" URI_NT remoteRepoURILens
<*> optionalField "secure" remoteRepoSecureLens
<*> monoidalFieldAla "root-keys" (alaList' FSep Token) remoteRepoRootKeysLens
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,7 @@ instance Arbitrary URI where

instance Arbitrary URIAuth where
arbitrary =
URIAuth
<$> pure "" -- no password as this does not roundtrip
pure (URIAuth "") -- no password as this does not roundtrip
<*> arbitraryURIToken
<*> arbitraryURIPort

Expand Down
2 changes: 1 addition & 1 deletion cabal-install/tests/UnitTests/Distribution/Client/VCS.hs
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ instance Arbitrary RepoDirSet where
arbitrary =
sized $ \n ->
oneof $
[RepoDirSet <$> pure 1]
[pure (RepoDirSet 1)]
++ [RepoDirSet <$> choose (2, 5) | n >= 3]
shrink (RepoDirSet n) =
[RepoDirSet i | i <- shrink n, i > 0]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,7 @@ instance Arbitrary Component where
-- internal libraries.
arbitraryUQN :: Gen UnqualComponentName
arbitraryUQN =
mkUnqualComponentName <$> (\c -> "component-" ++ [c]) <$> elements "ABC"
mkUnqualComponentName . (\c -> "component-" ++ [c]) <$> elements "ABC"

instance Arbitrary ExampleInstalled where
arbitrary = error "arbitrary not implemented: ExampleInstalled"
Expand Down
Loading