Skip to content

Commit fa58055

Browse files
authored
Merge pull request #6044 from commercialhaskell/fixConstraints
Remove redundant `HasLogFunc env` constraints
2 parents 89a536d + ba5995d commit fa58055

File tree

10 files changed

+26
-47
lines changed

10 files changed

+26
-47
lines changed

src/Stack/Build.hs

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ checkCabalVersion = do
207207

208208
-- | See https://github.com/commercialhaskell/stack/issues/1198.
209209
warnIfExecutablesWithSameNameCouldBeOverwritten ::
210-
(HasLogFunc env, HasTerm env)
210+
HasTerm env
211211
=> [LocalPackage]
212212
-> Plan
213213
-> RIO env ()
@@ -289,10 +289,7 @@ warnIfExecutablesWithSameNameCouldBeOverwritten locals plan = do
289289
collect :: Ord k => [(k,v)] -> Map k (NonEmpty v)
290290
collect = Map.map NE.fromList . Map.fromDistinctAscList . groupSort
291291

292-
warnAboutSplitObjs ::
293-
(HasLogFunc env, HasTerm env)
294-
=> BuildOpts
295-
-> RIO env ()
292+
warnAboutSplitObjs :: HasTerm env => BuildOpts -> RIO env ()
296293
warnAboutSplitObjs bopts | boptsSplitObjs bopts =
297294
prettyWarnL
298295
[ flow "Building with"
@@ -426,13 +423,11 @@ checkComponentsBuildable lps =
426423
]
427424

428425
-- | Find if sublibrary dependency exist in each project
429-
checkSubLibraryDependencies ::
430-
(HasLogFunc env, HasTerm env)
431-
=> [ProjectPackage]
432-
-> RIO env ()
426+
checkSubLibraryDependencies :: HasTerm env => [ProjectPackage] -> RIO env ()
433427
checkSubLibraryDependencies proj =
434428
forM_ proj $ \p -> do
435-
C.GenericPackageDescription _ _ _ lib subLibs foreignLibs exes tests benches <- liftIO $ cpGPD . ppCommon $ p
429+
C.GenericPackageDescription _ _ _ lib subLibs foreignLibs exes tests benches <-
430+
liftIO $ cpGPD . ppCommon $ p
436431

437432
let dependencies = concatMap getDeps subLibs <>
438433
concatMap getDeps foreignLibs <>

src/Stack/Build/Execute.hs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -798,12 +798,7 @@ executePlan' installedMap0 targets plan ee@ExecuteEnv {..} = do
798798
$ planUnregisterLocal plan
799799

800800
unregisterPackages ::
801-
( HasCompiler env
802-
, HasLogFunc env
803-
, HasPlatform env
804-
, HasProcessContext env
805-
, HasTerm env
806-
)
801+
(HasCompiler env, HasPlatform env, HasProcessContext env, HasTerm env)
807802
=> ActualCompiler
808803
-> Path Abs Dir
809804
-> NonEmpty (GhcPkgId, (PackageIdentifier, Text))
@@ -2686,7 +2681,7 @@ expectBenchmarkFailure pname =
26862681
maybe False (Set.member pname . curatorExpectBenchmarkFailure)
26872682

26882683
fulfillCuratorBuildExpectations ::
2689-
(HasCallStack, HasLogFunc env, HasTerm env)
2684+
(HasCallStack, HasTerm env)
26902685
=> PackageName
26912686
-> Maybe Curator
26922687
-> Bool

src/Stack/ComponentFile.hs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -395,11 +395,7 @@ findCandidate dirs name = do
395395
--
396396
-- For example: .erb for a Ruby file might exist in one of the
397397
-- directories.
398-
logPossibilities ::
399-
HasTerm env
400-
=> [Path Abs Dir]
401-
-> ModuleName
402-
-> RIO env ()
398+
logPossibilities :: HasTerm env => [Path Abs Dir] -> ModuleName -> RIO env ()
403399
logPossibilities dirs mn = do
404400
possibilities <- fmap concat (makePossibilities mn)
405401
unless (null possibilities) $ prettyWarnL

src/Stack/Coverage.hs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -581,8 +581,7 @@ findPackageFieldForBuiltPackage pkgDir pkgId internalLibs field = do
581581
<> T.pack (toFilePath inplaceDir)
582582
<> ". Maybe try 'stack clean' on this package?"
583583

584-
displayReportPath :: (HasTerm env)
585-
=> StyleDoc -> Text -> StyleDoc -> RIO env ()
584+
displayReportPath :: HasTerm env => StyleDoc -> Text -> StyleDoc -> RIO env ()
586585
displayReportPath prefix report reportPath =
587586
prettyInfo $
588587
prefix

src/Stack/FileWatch.hs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ import System.FSNotify
2121
import System.IO ( getLine )
2222

2323
fileWatch ::
24-
(HasLogFunc env, HasTerm env)
24+
HasTerm env
2525
=> ((Set (Path Abs File) -> IO ()) -> RIO env ())
2626
-> RIO env ()
2727
fileWatch = fileWatchConf defaultConfig
2828

2929
fileWatchPoll ::
30-
(HasLogFunc env, HasTerm env)
30+
HasTerm env
3131
=> ((Set (Path Abs File) -> IO ()) -> RIO env ())
3232
-> RIO env ()
3333
fileWatchPoll =
@@ -38,7 +38,7 @@ fileWatchPoll =
3838
-- The action provided takes a callback that is used to set the files to be
3939
-- watched. When any of those files are changed, we rerun the action again.
4040
fileWatchConf ::
41-
(HasLogFunc env, HasTerm env)
41+
HasTerm env
4242
=> WatchConfig
4343
-> ((Set (Path Abs File) -> IO ()) -> RIO env ())
4444
-> RIO env ()

src/Stack/GhcPkg.hs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ import System.FilePath ( searchPathSeparator )
3232

3333
-- | Get the global package database
3434
getGlobalDB ::
35-
(HasLogFunc env, HasProcessContext env, HasTerm env)
35+
(HasProcessContext env, HasTerm env)
3636
=> GhcPkgExe
3737
-> RIO env (Path Abs Dir)
3838
getGlobalDB pkgexe = do
@@ -51,7 +51,7 @@ getGlobalDB pkgexe = do
5151

5252
-- | Run the ghc-pkg executable
5353
ghcPkg ::
54-
(HasLogFunc env, HasProcessContext env, HasTerm env)
54+
(HasProcessContext env, HasTerm env)
5555
=> GhcPkgExe
5656
-> [Path Abs Dir]
5757
-> [String]
@@ -70,7 +70,7 @@ ghcPkg pkgexe@(GhcPkgExe pkgPath) pkgDbs args = do
7070

7171
-- | Create a package database in the given directory, if it doesn't exist.
7272
createDatabase ::
73-
(HasLogFunc env, HasProcessContext env, HasTerm env)
73+
(HasProcessContext env, HasTerm env)
7474
=> GhcPkgExe
7575
-> Path Abs Dir
7676
-> RIO env ()
@@ -116,7 +116,7 @@ packageDbFlags pkgDbs =
116116

117117
-- | Get the value of a field of the package.
118118
findGhcPkgField ::
119-
(HasLogFunc env, HasProcessContext env, HasTerm env)
119+
(HasProcessContext env, HasTerm env)
120120
=> GhcPkgExe
121121
-> [Path Abs Dir] -- ^ package databases
122122
-> String -- ^ package identifier, or GhcPkgId
@@ -138,7 +138,7 @@ findGhcPkgField pkgexe pkgDbs name field = do
138138
-- see https://github.com/commercialhaskell/stack/issues/2662#issuecomment-460342402
139139
-- using GHC package id where available (from GHC 7.9)
140140
unregisterGhcPkgIds ::
141-
( HasLogFunc env, HasProcessContext env, HasTerm env)
141+
(HasProcessContext env, HasTerm env)
142142
=> GhcPkgExe
143143
-> Path Abs Dir -- ^ package database
144144
-> NonEmpty (Either PackageIdentifier GhcPkgId)

src/Stack/Ghci.hs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -861,10 +861,7 @@ wantedPackageComponents bopts (TargetAll PTProject) pkg = S.fromList $
861861
(if boptsBenchmarks bopts then map CBench (S.toList (packageBenchmarks pkg)) else [])
862862
wantedPackageComponents _ _ _ = S.empty
863863

864-
checkForIssues ::
865-
(HasLogFunc env, HasTerm env)
866-
=> [GhciPkgInfo]
867-
-> RIO env ()
864+
checkForIssues :: HasTerm env => [GhciPkgInfo] -> RIO env ()
868865
checkForIssues pkgs =
869866
when (length pkgs > 1) $ do
870867
-- Cabal flag issues could arise only when there are at least 2 packages

src/Stack/PackageDump.hs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ instance Exception PackageDumpException where
5858
-- | Call ghc-pkg dump with appropriate flags and stream to the given @Sink@,
5959
-- for a single database
6060
ghcPkgDump ::
61-
(HasLogFunc env, HasProcessContext env, HasTerm env)
61+
(HasProcessContext env, HasTerm env)
6262
=> GhcPkgExe
6363
-> [Path Abs Dir] -- ^ if empty, use global
6464
-> ConduitM Text Void (RIO env) a
@@ -68,7 +68,7 @@ ghcPkgDump pkgexe = ghcPkgCmdArgs pkgexe ["dump"]
6868
-- | Call ghc-pkg describe with appropriate flags and stream to the given
6969
-- @Sink@, for a single database
7070
ghcPkgDescribe ::
71-
(HasCompiler env, HasLogFunc env, HasProcessContext env, HasTerm env)
71+
(HasCompiler env, HasProcessContext env, HasTerm env)
7272
=> GhcPkgExe
7373
-> PackageName
7474
-> [Path Abs Dir] -- ^ if empty, use global
@@ -79,7 +79,7 @@ ghcPkgDescribe pkgexe pkgName' = ghcPkgCmdArgs
7979

8080
-- | Call ghc-pkg and stream to the given @Sink@, for a single database
8181
ghcPkgCmdArgs ::
82-
(HasLogFunc env, HasProcessContext env, HasTerm env)
82+
(HasProcessContext env, HasTerm env)
8383
=> GhcPkgExe
8484
-> [String]
8585
-> [Path Abs Dir] -- ^ if empty, use global

src/Stack/Setup.hs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -796,10 +796,7 @@ ensureCompilerAndMsys sopts = do
796796
pure (cp, paths)
797797

798798
-- | See <https://github.com/commercialhaskell/stack/issues/4246>
799-
warnUnsupportedCompiler ::
800-
(HasLogFunc env, HasTerm env)
801-
=> Version
802-
-> RIO env Bool
799+
warnUnsupportedCompiler :: HasTerm env => Version -> RIO env Bool
803800
warnUnsupportedCompiler ghcVersion =
804801
if
805802
| ghcVersion < mkVersion [7, 8] -> do
@@ -827,7 +824,7 @@ warnUnsupportedCompiler ghcVersion =
827824

828825
-- | See <https://github.com/commercialhaskell/stack/issues/4246>
829826
warnUnsupportedCompilerCabal ::
830-
(HasLogFunc env, HasTerm env)
827+
HasTerm env
831828
=> CompilerPaths
832829
-> Bool -- ^ already warned about GHC?
833830
-> RIO env ()
@@ -1555,7 +1552,7 @@ mungeRelease = intercalate "-" . prefixMaj . splitOn "."
15551552
prefixMaj = prefixFst "maj" prefixMin
15561553
prefixMin = prefixFst "min" (map ('r':))
15571554

1558-
sysRelease :: (HasLogFunc env, HasTerm env) => RIO env String
1555+
sysRelease :: HasTerm env => RIO env String
15591556
sysRelease =
15601557
handleIO
15611558
( \e -> do
@@ -2245,7 +2242,7 @@ removeHaskellEnvVars =
22452242

22462243
-- | Get map of environment variables to set to change the GHC's encoding to UTF-8
22472244
getUtf8EnvVars ::
2248-
(HasLogFunc env, HasPlatform env, HasProcessContext env, HasTerm env)
2245+
(HasPlatform env, HasProcessContext env, HasTerm env)
22492246
=> ActualCompiler
22502247
-> RIO env (Map Text Text)
22512248
getUtf8EnvVars compilerVer =

src/Stack/SourceMap.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ getPLIVersion (PLIArchive _ pm) = pkgVersion $ pmIdent pm
138138
getPLIVersion (PLIRepo _ pm) = pkgVersion $ pmIdent pm
139139

140140
globalsFromDump ::
141-
(HasLogFunc env, HasProcessContext env, HasTerm env)
141+
(HasProcessContext env, HasTerm env)
142142
=> GhcPkgExe
143143
-> RIO env (Map PackageName DumpedGlobalPackage)
144144
globalsFromDump pkgexe = do

0 commit comments

Comments
 (0)