Skip to content

Commit

Permalink
Format files
Browse files Browse the repository at this point in the history
  • Loading branch information
edmundnoble committed Apr 7, 2024
1 parent 5f90c11 commit be2695f
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 42 deletions.
2 changes: 1 addition & 1 deletion Cabal/src/Distribution/Simple/Glob/Internal.hs
Original file line number Diff line number Diff line change
Expand Up @@ -457,8 +457,8 @@ checkNameMatches spec glob candidate
-- if multidot is supported, then this is a clean match
if enableMultidot spec
then pure (GlobMatch ())
else -- if not, issue a warning saying multidot is needed for the match

else -- if not, issue a warning saying multidot is needed for the match
let (_, candidateExts) = splitExtensions $ takeFileName candidate
extractExts :: GlobPieces -> Maybe String
extractExts [] = Nothing
Expand Down
15 changes: 8 additions & 7 deletions cabal-install/src/Distribution/Client/FileMonitor.hs
Original file line number Diff line number Diff line change
Expand Up @@ -286,9 +286,9 @@ instance Structured MonitorStateGlobRel
-- direction by just forgetting the extra info.
reconstructMonitorFilePaths :: MonitorStateFileSet -> Set MonitorFilePath
reconstructMonitorFilePaths (MonitorStateFileSet singlePaths globPaths) =
Set.fromList
$ map getSinglePath (Set.toList singlePaths)
<> map getGlobPath (Set.toList globPaths)
Set.fromList $
map getSinglePath (Set.toList singlePaths)
<> map getGlobPath (Set.toList globPaths)
where
getSinglePath :: MonitorStateFile -> MonitorFilePath
getSinglePath (MonitorStateFile kindfile kinddir filepath _) =
Expand Down Expand Up @@ -576,10 +576,11 @@ probeFileSystem root (MonitorStateFileSet singlePaths globPaths) =
]
-- The glob monitors can require state changes
globPaths' <-
Set.fromList <$> sequence
[ probeMonitorStateGlob root globPath
| globPath <- Set.toList globPaths
]
Set.fromList
<$> sequence
[ probeMonitorStateGlob root globPath
| globPath <- Set.toList globPaths
]
return (MonitorStateFileSet singlePaths globPaths')

-----------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,8 @@ buildInplaceUnpackedPackage

let listSimple =
execRebuild srcdir (needElaboratedConfiguredPackage pkg)
listSdist = fmap (Set.fromList . map monitorFileHashed) $
listSdist =
fmap (Set.fromList . map monitorFileHashed) $
allPackageSourceFiles verbosity srcdir
ifNullThen m m' = do
xs <- m
Expand All @@ -500,12 +501,12 @@ buildInplaceUnpackedPackage

let dep_monitors =
Set.fromList $
map monitorFileHashed $
elabInplaceDependencyBuildCacheFiles
distDirLayout
pkgshared
plan
pkg
map monitorFileHashed $
elabInplaceDependencyBuildCacheFiles
distDirLayout
pkgshared
plan
pkg
updatePackageBuildFileMonitor
packageFileMonitor
srcdir
Expand Down
10 changes: 5 additions & 5 deletions cabal-install/src/Distribution/Client/ProjectPlanning.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1165,11 +1165,11 @@ getPackageSourceHashes verbosity withRepoCtx solverPlan = do
return (pkgid, srchash)
| (pkgid, tarball) <- allTarballFilePkgs
]
monitorFiles
$ Set.fromList
[ monitorFile tarball
| (_pkgid, tarball) <- allTarballFilePkgs
]
monitorFiles $
Set.fromList
[ monitorFile tarball
| (_pkgid, tarball) <- allTarballFilePkgs
]

-- Return the combination
return $!
Expand Down
36 changes: 18 additions & 18 deletions cabal-install/src/Distribution/Client/RebuildMonad.hs
Original file line number Diff line number Diff line change
Expand Up @@ -257,12 +257,12 @@ createDirectoryMonitored createParents dir = do
monitorDirectoryStatus :: FilePath -> Rebuild Bool
monitorDirectoryStatus dir = do
exists <- liftIO $ doesDirectoryExist dir
monitorFiles
$ Set.singleton
( if exists
then monitorDirectory dir
else monitorNonExistentDirectory dir
)
monitorFiles $
Set.singleton
( if exists
then monitorDirectory dir
else monitorNonExistentDirectory dir
)
return exists

-- | Like 'doesFileExist', but in the 'Rebuild' monad. This does
Expand All @@ -271,12 +271,12 @@ doesFileExistMonitored :: FilePath -> Rebuild Bool
doesFileExistMonitored f = do
root <- askRoot
exists <- liftIO $ doesFileExist (root </> f)
monitorFiles
$ Set.singleton
( if exists
then monitorFileExistence f
else monitorNonExistentFile f
)
monitorFiles $
Set.singleton
( if exists
then monitorFileExistence f
else monitorNonExistentFile f
)
return exists

-- | Monitor a single file
Expand All @@ -292,12 +292,12 @@ needIfExists :: FilePath -> Rebuild ()
needIfExists f = do
root <- askRoot
exists <- liftIO $ doesFileExist (root </> f)
monitorFiles
$ Set.singleton
( if exists
then monitorFileHashed f
else monitorNonExistentFile f
)
monitorFiles $
Set.singleton
( if exists
then monitorFileHashed f
else monitorNonExistentFile f
)

-- | Like 'findFileWithExtension', but in the 'Rebuild' monad.
findFileWithExtensionMonitored
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -450,10 +450,11 @@ testMultipleMonitorKinds mtimeChange =
updateMonitor
root
monitor
(Set.fromList
[ monitorDirectory "dir"
, monitorDirectoryExistence "dir"
])
( Set.fromList
[ monitorDirectory "dir"
, monitorDirectoryExistence "dir"
]
)
()
()
(res2, files2) <- expectMonitorUnchanged root monitor ()
Expand Down

0 comments on commit be2695f

Please sign in to comment.