Skip to content

Commit 961fac2

Browse files
committed
bring back prettyInfoS and prettyDebugS
1 parent ab76696 commit 961fac2

2 files changed

Lines changed: 20 additions & 30 deletions

File tree

src/Stack/Coverage.hs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ generateHpcReport pkgDir package tests = do
130130
Just includeName -> ["--include", includeName ++ ":"]
131131
Nothing -> []
132132
mreportPath <- generateHpcReportInternal tixSrc reportDir report extraArgs extraArgs
133-
forM_ mreportPath (displayReportPath report)
133+
forM_ mreportPath (displayReportPath report . display)
134134

135135
generateHpcReportInternal :: HasEnvConfig env
136136
=> Path Abs File -> Path Abs Dir -> Text -> [String] -> [String]
@@ -267,7 +267,7 @@ generateHpcReportForTargets opts = do
267267
then do
268268
prettyInfo $ "Opening" <+> display reportPath <+> "in the browser."
269269
void $ liftIO $ openBrowser (toFilePath reportPath)
270-
else displayReportPath report reportPath
270+
else displayReportPath report (display reportPath)
271271

272272
generateHpcUnifiedReport :: HasEnvConfig env => RIO env ()
273273
generateHpcUnifiedReport = do
@@ -292,7 +292,7 @@ generateHpcUnifiedReport = do
292292
else do
293293
let report = "unified report"
294294
mreportPath <- generateUnionReport report reportDir tixFiles
295-
forM_ mreportPath (displayReportPath report)
295+
forM_ mreportPath (displayReportPath report . display)
296296

297297
generateUnionReport :: HasEnvConfig env
298298
=> Text -> Path Abs Dir -> [Path Abs File]
@@ -439,10 +439,10 @@ findPackageFieldForBuiltPackage pkgDir pkgId field = do
439439
_ -> return $ Left $ "Multiple files matching " <> T.pack (pkgIdStr ++ "-*.conf") <> " found in " <>
440440
T.pack (toFilePath inplaceDir) <> ". Maybe try 'stack clean' on this package?"
441441

442-
displayReportPath :: (HasAnsiAnn (Ann a), Display a, HasRunner env)
443-
=> Text -> a -> RIO env ()
442+
displayReportPath :: (HasRunner env)
443+
=> Text -> AnsiDoc -> RIO env ()
444444
displayReportPath report reportPath =
445-
prettyInfo $ "The" <+> fromString (T.unpack report) <+> "is available at" <+> display reportPath
445+
prettyInfo $ "The" <+> fromString (T.unpack report) <+> "is available at" <+> reportPath
446446

447447
findExtraTixFiles :: HasEnvConfig env => RIO env [Path Abs File]
448448
findExtraTixFiles = do

src/Stack/PrettyPrint.hs

Lines changed: 14 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ module Stack.PrettyPrint
1111
-- * Logging based on pretty-print typeclass
1212
, prettyDebug, prettyInfo, prettyWarn, prettyError
1313
, prettyDebugL, prettyInfoL, prettyWarnL, prettyErrorL
14-
, prettyWarnS, prettyErrorS
14+
, prettyDebugS, prettyInfoS, prettyWarnS, prettyErrorS
1515
-- * Semantic styling functions
1616
-- | These are preferred to styling or colors directly, so that we can
1717
-- encourage consistency.
@@ -62,53 +62,43 @@ prettyWith level f = logOther level <=< displayWithColor . f
6262

6363
-- Note: I think keeping this section aligned helps spot errors, might be
6464
-- worth keeping the alignment in place.
65-
prettyDebugWith, prettyInfoWith
66-
:: (HasCallStack, HasRunner env, Display b, HasAnsiAnn (Ann b),
67-
MonadReader env m, MonadLogger m)
68-
=> (a -> b) -> a -> m ()
69-
prettyDebugWith = prettyWith LevelDebug
70-
prettyInfoWith = prettyWith LevelInfo
7165

72-
prettyWarnWith, prettyErrorWith
66+
prettyDebugWith, prettyInfoWith, prettyWarnWith, prettyErrorWith
7367
:: (HasCallStack, HasRunner env, MonadReader env m, MonadLogger m)
7468
=> (a -> Doc AnsiAnn) -> a -> m ()
69+
prettyDebugWith = prettyWith LevelDebug
70+
prettyInfoWith = prettyWith LevelInfo
7571
prettyWarnWith f = prettyWith LevelWarn
7672
((line <>) . (styleWarning "Warning:" <+>) .
7773
indentAfterLabel . f)
7874
prettyErrorWith f = prettyWith LevelError
7975
((line <>) . (styleError "Error:" <+>) .
8076
indentAfterLabel . f)
8177

82-
prettyDebug, prettyInfo
83-
:: (HasCallStack, HasRunner env, Display b, HasAnsiAnn (Ann b),
84-
MonadReader env m, MonadLogger m)
85-
=> b -> m ()
86-
prettyDebug = prettyDebugWith id
87-
prettyInfo = prettyInfoWith id
88-
89-
prettyWarn, prettyError
78+
prettyDebug, prettyInfo, prettyWarn, prettyError
9079
:: (HasCallStack, HasRunner env, MonadReader env m, MonadLogger m)
9180
=> Doc AnsiAnn -> m ()
81+
prettyDebug = prettyDebugWith id
82+
prettyInfo = prettyInfoWith id
9283
prettyWarn = prettyWarnWith id
9384
prettyError = prettyErrorWith id
9485

95-
prettyDebugL, prettyInfoL
96-
:: (HasCallStack, HasRunner env, HasAnsiAnn a, MonadReader env m, MonadLogger m)
97-
=> [Doc a] -> m ()
98-
prettyDebugL = prettyDebugWith fillSep
99-
prettyInfoL = prettyInfoWith fillSep
100-
101-
prettyWarnL, prettyErrorL
86+
prettyDebugL, prettyInfoL, prettyWarnL, prettyErrorL
10287
:: (HasCallStack, HasRunner env, MonadReader env m, MonadLogger m)
10388
=> [Doc AnsiAnn] -> m ()
89+
prettyDebugL = prettyDebugWith fillSep
90+
prettyInfoL = prettyInfoWith fillSep
10491
prettyWarnL = prettyWarnWith fillSep
10592
prettyErrorL = prettyErrorWith fillSep
10693

107-
prettyWarnS, prettyErrorS
94+
prettyDebugS, prettyInfoS, prettyWarnS, prettyErrorS
10895
:: (HasCallStack, HasRunner env, MonadReader env m, MonadLogger m)
10996
=> String -> m ()
97+
prettyDebugS = prettyDebugWith flow
98+
prettyInfoS = prettyInfoWith flow
11099
prettyWarnS = prettyWarnWith flow
111100
prettyErrorS = prettyErrorWith flow
101+
112102
-- End of aligned section
113103

114104
-- | Use after a label and before the rest of what's being labelled for

0 commit comments

Comments
 (0)