Skip to content

Commit fa69941

Browse files
committed
Add more signatures for local functions
1 parent 536461a commit fa69941

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/Stack/Build/Execute.hs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ getSetupExe setupHs setupShimHs tmpdir = do
330330
return $ Just exePath
331331

332332
-- | Execute a function that takes an 'ExecuteEnv'.
333-
withExecuteEnv :: (StackM env m, HasEnvConfig env)
333+
withExecuteEnv :: forall env m a. (StackM env m, HasEnvConfig env)
334334
=> EnvOverride
335335
-> BuildOpts
336336
-> BuildOptsCLI
@@ -405,6 +405,7 @@ withExecuteEnv menv bopts boptsCli baseConfigOpts locals globalPackages snapshot
405405
where
406406
toDumpPackagesByGhcPkgId = Map.fromList . map (\dp -> (dpGhcPkgId dp, dp))
407407

408+
dumpLogs :: TChan (Path Abs Dir, Path Abs File) -> Int -> m ()
408409
dumpLogs chan totalWanted = do
409410
allLogs <- fmap reverse $ liftIO $ atomically drainChan
410411
case allLogs of
@@ -425,6 +426,7 @@ withExecuteEnv menv bopts boptsCli baseConfigOpts locals globalPackages snapshot
425426
$logInfo $ T.pack $ "Log files have been written to: "
426427
++ toFilePath (parent (snd firstLog))
427428
where
429+
drainChan :: STM [(Path Abs Dir, Path Abs File)]
428430
drainChan = do
429431
mx <- tryReadTChan chan
430432
case mx of
@@ -433,6 +435,7 @@ withExecuteEnv menv bopts boptsCli baseConfigOpts locals globalPackages snapshot
433435
xs <- drainChan
434436
return $ x:xs
435437

438+
dumpLogIfWarning :: (Path Abs Dir, Path Abs File) -> m ()
436439
dumpLogIfWarning (pkgDir, filepath) = do
437440
firstWarning <- runResourceT
438441
$ CB.sourceFile (toFilePath filepath)
@@ -443,9 +446,11 @@ withExecuteEnv menv bopts boptsCli baseConfigOpts locals globalPackages snapshot
443446
=$ CL.take 1
444447
unless (null firstWarning) $ dumpLog " due to warnings" (pkgDir, filepath)
445448

449+
isWarning :: Text -> Bool
446450
isWarning t = ": Warning:" `T.isSuffixOf` t -- prior to GHC 8
447451
|| ": warning:" `T.isInfixOf` t -- GHC 8 is slightly different
448452

453+
dumpLog :: String -> (Path Abs Dir, Path Abs File) -> m ()
449454
dumpLog msgSuffix (pkgDir, filepath) = do
450455
$logInfo $ T.pack $ concat ["\n-- Dumping log file", msgSuffix, ": ", toFilePath filepath, "\n"]
451456
runResourceT
@@ -993,6 +998,7 @@ withSingleContext runInBase ActionContext {..} ExecuteEnv {..} task@Task {..} md
993998
: ["-hide-all-packages"]
994999
)
9951000

1001+
warnCustomNoDeps :: m ()
9961002
warnCustomNoDeps =
9971003
case (taskType, packageBuildType package) of
9981004
(TTLocal{}, Just C.Custom) -> do
@@ -1005,6 +1011,7 @@ withSingleContext runInBase ActionContext {..} ExecuteEnv {..} task@Task {..} md
10051011
$logWarn "Strongly recommend fixing the package's cabal file"
10061012
_ -> return ()
10071013

1014+
getPackageArgs :: Path Abs Dir -> m [String]
10081015
getPackageArgs setupDir =
10091016
case (packageSetupDeps package, mdeps) of
10101017
-- The package is using the Cabal custom-setup
@@ -1084,6 +1091,8 @@ withSingleContext runInBase ActionContext {..} ExecuteEnv {..} task@Task {..} md
10841091
++ ["-package-db=" ++ toFilePathNoTrailingSep (bcoSnapDB eeBaseConfigOpts)])
10851092

10861093
setupArgs = ("--builddir=" ++ toFilePathNoTrailingSep distRelativeDir') : args
1094+
1095+
runExe :: Path Abs File -> [String] -> m ()
10871096
runExe exeName fullArgs =
10881097
runAndOutput `catch` \(ProcessExitedUnsuccessfully _ ec) -> do
10891098
bss <-
@@ -1104,6 +1113,7 @@ withSingleContext runInBase ActionContext {..} ExecuteEnv {..} task@Task {..} md
11041113
(fmap fst mlogFile)
11051114
bss
11061115
where
1116+
runAndOutput :: m ()
11071117
runAndOutput = case mlogFile of
11081118
Just (_, h) ->
11091119
sinkProcessStderrStdoutHandle (Just pkgDir) menv (toFilePath exeName) fullArgs h h

0 commit comments

Comments
 (0)