Skip to content

Commit

Permalink
Format files
Browse files Browse the repository at this point in the history
  • Loading branch information
edmundnoble committed Mar 26, 2024
1 parent d16498e commit da19bf1
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 45 deletions.
1 change: 0 additions & 1 deletion Cabal/src/Distribution/Simple/Glob/Internal.hs
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,6 @@ checkNameMatches spec glob candidate
if enableMultidot spec
then pure (GlobMatch ())
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
2 changes: 1 addition & 1 deletion cabal-install/src/Distribution/Client/ProjectConfig.hs
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ resolveBuildTimeSettings
cabalLogsDirectory
</> "$compiler"
</> "$libname"
<.> "log"
<.> "log"
givenTemplate = flagToMaybe projectConfigLogFile

useDefaultTemplate
Expand Down
12 changes: 6 additions & 6 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 Expand Up @@ -1671,7 +1671,7 @@ elaborateInstallPlan
dieProgress $
text "Internal libraries only supported with per-component builds."
$$ text "Per-component builds were disabled because"
<+> fsep (punctuate comma $ map (text . whyNotPerComponent) $ toList reasons)
<+> fsep (punctuate comma $ map (text . whyNotPerComponent) $ toList reasons)
-- TODO: Maybe exclude Backpack too

elab0 = elaborateSolverToCommon spkg
Expand Down
38 changes: 19 additions & 19 deletions cabal-install/src/Distribution/Client/RebuildMonad.hs
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ import Distribution.Simple.Utils (debug)

import Control.Concurrent.MVar (MVar, modifyMVar, newMVar)
import Control.Monad.Reader as Reader
import Control.Monad.Writer.CPS as Writer
import Control.Monad.Trans.Writer.CPS (runWriterT)
import Control.Monad.Writer.CPS as Writer
import qualified Data.Map.Strict as Map
import qualified Data.Set as Set
import System.Directory
Expand Down Expand Up @@ -258,12 +258,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 @@ -272,12 +272,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 @@ -293,12 +293,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 da19bf1

Please sign in to comment.