Skip to content

Follow HLint suggestion: use <$>#12015

Open
philderbeast wants to merge 19 commits into
haskell:masterfrom
cabalism:hlint/use-fmap-operator
Open

Follow HLint suggestion: use <$>#12015
philderbeast wants to merge 19 commits into
haskell:masterfrom
cabalism:hlint/use-fmap-operator

Conversation

@philderbeast

Copy link
Copy Markdown
Collaborator

See #9110. Discharges and no longer ignores HLint's "use <$>" suggestion so that this will be suggested by our CI linting.

A similar suggestion, "use fmap", was merged earlier, with #11742.

There were some cascading suggestions that I tackled individually. I'll squash commits before applying the merge label if this pull request is approved.


  • Patches conform to the coding conventions.
  • Is this a PR that fixes CI? If so, it will need to be backported to older cabal release branches (ask maintainers for directions).

@philderbeast philderbeast marked this pull request as draft June 24, 2026 01:47
@philderbeast philderbeast force-pushed the hlint/use-fmap-operator branch 6 times, most recently from 032d9c5 to c0f2629 Compare June 24, 2026 02:22
@philderbeast philderbeast marked this pull request as ready for review June 24, 2026 02:22
@philderbeast philderbeast force-pushed the hlint/use-fmap-operator branch from c0f2629 to d6f48d1 Compare June 26, 2026 00:13
@philderbeast philderbeast force-pushed the hlint/use-fmap-operator branch from d6f48d1 to 388296c Compare July 1, 2026 18:35
Comment thread cabal-install/src/Distribution/Client/IndexUtils/ActiveRepos.hs Outdated
Comment thread cabal-install/src/Distribution/Client/FileMonitor.hs Outdated
Map.lookup pkgid availableTargetsByPackageId =
fmap (componentTargets WholeComponent) $
selectPackageTargets bt ats
maybe id filterTargetsKind mkfilter <$> Map.lookup pkgid availableTargetsByPackageId =

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could maybe id filterTargetsKind mkfilter be moved from pattern guard to the RHS? LIke

  | Just ats <- Map.lookup ...
  = componentTargets WholeComponent <$> selectPackageTargets bt (maybe id filterTargetsKind mkfilter ats)

(I didn't check if it compiles)

Same question below.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It compiles.

_ <- Parse.char ':'
b <- tokenQEnd
return (TargetString2 a b)
TargetString2 a <$> tokenQEnd

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we do TargetString2 <$> tokenQ0 <* Parse.char ':' <$> tokenQEnd? Same below.

Comment thread cabal-install/tests/UnitTests/Distribution/Client/ArbitraryInstances.hs Outdated
getEntries ProgramSearchPathDefault = do
env <- getEnvironment
return (maybe [] splitSearchPath (lookup "PATH" env))
getEntries ProgramSearchPathDefault = maybe [] splitSearchPath . lookup "PATH" <$> getEnvironment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we are changing it anyway, let's use lookupEnv.

Comment thread cabal-install/tests/UnitTests/Distribution/Client/ProjectConfig.hs Outdated
Comment thread Cabal-syntax/src/Distribution/Types/CondTree.hs Outdated
@philderbeast philderbeast force-pushed the hlint/use-fmap-operator branch from 1834ec6 to 91914a5 Compare July 5, 2026 12:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants