-
Notifications
You must be signed in to change notification settings - Fork 110
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ConsoleReporter.hs: fix unbound implicit variable with -XApplicativeDo #405
Conversation
Could you possibly elaborate and provide instructions how to reproduce the error please? I assume this has something to do with https://gitlab.haskell.org/ghc/ghc/-/issues/20630, but I don't know why to enable |
I ran OutputBuild profile: -w ghc-9.8.1 -O1
In order, the following will be built (use -v for more details):
- ansi-terminal-1.0.2 (lib) (requires build)
- prettyprinter-ansi-terminal-1.1.3 (lib) (requires build)
- optparse-applicative-0.18.1.0 (lib) (requires build)
- tasty-1.5 (lib) (first run)
Starting ansi-terminal-1.0.2 (lib)
Building ansi-terminal-1.0.2 (lib)
Installing ansi-terminal-1.0.2 (lib)
Completed ansi-terminal-1.0.2 (lib)
Starting prettyprinter-ansi-terminal-1.1.3 (lib)
Building prettyprinter-ansi-terminal-1.1.3 (lib)
Installing prettyprinter-ansi-terminal-1.1.3 (lib)
Completed prettyprinter-ansi-terminal-1.1.3 (lib)
Starting optparse-applicative-0.18.1.0 (lib)
Building optparse-applicative-0.18.1.0 (lib)
Installing optparse-applicative-0.18.1.0 (lib)
Completed optparse-applicative-0.18.1.0 (lib)
Configuring library for tasty-1.5..
Preprocessing library for tasty-1.5..
Building library for tasty-1.5..
[ 1 of 25] Compiling Control.Concurrent.Async ( Control/Concurrent/Async.hs, /Users/connorbaker/Packages/ghc_hyperopt/GHC-HyperOpt/deps/tasty/dist-newstyle/build/aarch64-osx/ghc-9.8.1/tasty-1.5/build/Control/Concurrent/Async.o, /Users/connorbaker/Packages/ghc_hyperopt/GHC-HyperOpt/deps/tasty/dist-newstyle/build/aarch64-osx/ghc-9.8.1/tasty-1.5/build/Control/Concurrent/Async.dyn_o )
[ 2 of 25] Compiling Test.Tasty.Options ( Test/Tasty/Options.hs, /Users/connorbaker/Packages/ghc_hyperopt/GHC-HyperOpt/deps/tasty/dist-newstyle/build/aarch64-osx/ghc-9.8.1/tasty-1.5/build/Test/Tasty/Options.o, /Users/connorbaker/Packages/ghc_hyperopt/GHC-HyperOpt/deps/tasty/dist-newstyle/build/aarch64-osx/ghc-9.8.1/tasty-1.5/build/Test/Tasty/Options.dyn_o )
[ 3 of 25] Compiling Test.Tasty.Parallel ( Test/Tasty/Parallel.hs, /Users/connorbaker/Packages/ghc_hyperopt/GHC-HyperOpt/deps/tasty/dist-newstyle/build/aarch64-osx/ghc-9.8.1/tasty-1.5/build/Test/Tasty/Parallel.o, /Users/connorbaker/Packages/ghc_hyperopt/GHC-HyperOpt/deps/tasty/dist-newstyle/build/aarch64-osx/ghc-9.8.1/tasty-1.5/build/Test/Tasty/Parallel.dyn_o )
[ 4 of 25] Compiling Test.Tasty.Patterns.Expr ( Test/Tasty/Patterns/Expr.hs, /Users/connorbaker/Packages/ghc_hyperopt/GHC-HyperOpt/deps/tasty/dist-newstyle/build/aarch64-osx/ghc-9.8.1/tasty-1.5/build/Test/Tasty/Patterns/Expr.o, /Users/connorbaker/Packages/ghc_hyperopt/GHC-HyperOpt/deps/tasty/dist-newstyle/build/aarch64-osx/ghc-9.8.1/tasty-1.5/build/Test/Tasty/Patterns/Expr.dyn_o )
[ 5 of 25] Compiling Test.Tasty.Patterns.Types ( Test/Tasty/Patterns/Types.hs, /Users/connorbaker/Packages/ghc_hyperopt/GHC-HyperOpt/deps/tasty/dist-newstyle/build/aarch64-osx/ghc-9.8.1/tasty-1.5/build/Test/Tasty/Patterns/Types.o, /Users/connorbaker/Packages/ghc_hyperopt/GHC-HyperOpt/deps/tasty/dist-newstyle/build/aarch64-osx/ghc-9.8.1/tasty-1.5/build/Test/Tasty/Patterns/Types.dyn_o )
[ 6 of 25] Compiling Test.Tasty.Patterns.Printer ( Test/Tasty/Patterns/Printer.hs, /Users/connorbaker/Packages/ghc_hyperopt/GHC-HyperOpt/deps/tasty/dist-newstyle/build/aarch64-osx/ghc-9.8.1/tasty-1.5/build/Test/Tasty/Patterns/Printer.o, /Users/connorbaker/Packages/ghc_hyperopt/GHC-HyperOpt/deps/tasty/dist-newstyle/build/aarch64-osx/ghc-9.8.1/tasty-1.5/build/Test/Tasty/Patterns/Printer.dyn_o )
[ 7 of 25] Compiling Test.Tasty.Patterns.Parser ( Test/Tasty/Patterns/Parser.hs, /Users/connorbaker/Packages/ghc_hyperopt/GHC-HyperOpt/deps/tasty/dist-newstyle/build/aarch64-osx/ghc-9.8.1/tasty-1.5/build/Test/Tasty/Patterns/Parser.o, /Users/connorbaker/Packages/ghc_hyperopt/GHC-HyperOpt/deps/tasty/dist-newstyle/build/aarch64-osx/ghc-9.8.1/tasty-1.5/build/Test/Tasty/Patterns/Parser.dyn_o )
[ 8 of 25] Compiling Test.Tasty.Patterns.Eval ( Test/Tasty/Patterns/Eval.hs, /Users/connorbaker/Packages/ghc_hyperopt/GHC-HyperOpt/deps/tasty/dist-newstyle/build/aarch64-osx/ghc-9.8.1/tasty-1.5/build/Test/Tasty/Patterns/Eval.o, /Users/connorbaker/Packages/ghc_hyperopt/GHC-HyperOpt/deps/tasty/dist-newstyle/build/aarch64-osx/ghc-9.8.1/tasty-1.5/build/Test/Tasty/Patterns/Eval.dyn_o )
[ 9 of 25] Compiling Test.Tasty.Patterns ( Test/Tasty/Patterns.hs, /Users/connorbaker/Packages/ghc_hyperopt/GHC-HyperOpt/deps/tasty/dist-newstyle/build/aarch64-osx/ghc-9.8.1/tasty-1.5/build/Test/Tasty/Patterns.o, /Users/connorbaker/Packages/ghc_hyperopt/GHC-HyperOpt/deps/tasty/dist-newstyle/build/aarch64-osx/ghc-9.8.1/tasty-1.5/build/Test/Tasty/Patterns.dyn_o )
[10 of 25] Compiling Test.Tasty.Options.Core ( Test/Tasty/Options/Core.hs, /Users/connorbaker/Packages/ghc_hyperopt/GHC-HyperOpt/deps/tasty/dist-newstyle/build/aarch64-osx/ghc-9.8.1/tasty-1.5/build/Test/Tasty/Options/Core.o, /Users/connorbaker/Packages/ghc_hyperopt/GHC-HyperOpt/deps/tasty/dist-newstyle/build/aarch64-osx/ghc-9.8.1/tasty-1.5/build/Test/Tasty/Options/Core.dyn_o )
[11 of 25] Compiling Test.Tasty.Providers.ConsoleFormat ( Test/Tasty/Providers/ConsoleFormat.hs, /Users/connorbaker/Packages/ghc_hyperopt/GHC-HyperOpt/deps/tasty/dist-newstyle/build/aarch64-osx/ghc-9.8.1/tasty-1.5/build/Test/Tasty/Providers/ConsoleFormat.o, /Users/connorbaker/Packages/ghc_hyperopt/GHC-HyperOpt/deps/tasty/dist-newstyle/build/aarch64-osx/ghc-9.8.1/tasty-1.5/build/Test/Tasty/Providers/ConsoleFormat.dyn_o )
[12 of 25] Compiling Test.Tasty.Core ( Test/Tasty/Core.hs, /Users/connorbaker/Packages/ghc_hyperopt/GHC-HyperOpt/deps/tasty/dist-newstyle/build/aarch64-osx/ghc-9.8.1/tasty-1.5/build/Test/Tasty/Core.o, /Users/connorbaker/Packages/ghc_hyperopt/GHC-HyperOpt/deps/tasty/dist-newstyle/build/aarch64-osx/ghc-9.8.1/tasty-1.5/build/Test/Tasty/Core.dyn_o )
[13 of 25] Compiling Test.Tasty.Providers ( Test/Tasty/Providers.hs, /Users/connorbaker/Packages/ghc_hyperopt/GHC-HyperOpt/deps/tasty/dist-newstyle/build/aarch64-osx/ghc-9.8.1/tasty-1.5/build/Test/Tasty/Providers.o, /Users/connorbaker/Packages/ghc_hyperopt/GHC-HyperOpt/deps/tasty/dist-newstyle/build/aarch64-osx/ghc-9.8.1/tasty-1.5/build/Test/Tasty/Providers.dyn_o )
[14 of 25] Compiling Test.Tasty.Runners.Reducers ( Test/Tasty/Runners/Reducers.hs, /Users/connorbaker/Packages/ghc_hyperopt/GHC-HyperOpt/deps/tasty/dist-newstyle/build/aarch64-osx/ghc-9.8.1/tasty-1.5/build/Test/Tasty/Runners/Reducers.o, /Users/connorbaker/Packages/ghc_hyperopt/GHC-HyperOpt/deps/tasty/dist-newstyle/build/aarch64-osx/ghc-9.8.1/tasty-1.5/build/Test/Tasty/Runners/Reducers.dyn_o )
[15 of 25] Compiling Test.Tasty.Runners.Utils ( Test/Tasty/Runners/Utils.hs, /Users/connorbaker/Packages/ghc_hyperopt/GHC-HyperOpt/deps/tasty/dist-newstyle/build/aarch64-osx/ghc-9.8.1/tasty-1.5/build/Test/Tasty/Runners/Utils.o, /Users/connorbaker/Packages/ghc_hyperopt/GHC-HyperOpt/deps/tasty/dist-newstyle/build/aarch64-osx/ghc-9.8.1/tasty-1.5/build/Test/Tasty/Runners/Utils.dyn_o )
[16 of 25] Compiling Test.Tasty.Run ( Test/Tasty/Run.hs, /Users/connorbaker/Packages/ghc_hyperopt/GHC-HyperOpt/deps/tasty/dist-newstyle/build/aarch64-osx/ghc-9.8.1/tasty-1.5/build/Test/Tasty/Run.o, /Users/connorbaker/Packages/ghc_hyperopt/GHC-HyperOpt/deps/tasty/dist-newstyle/build/aarch64-osx/ghc-9.8.1/tasty-1.5/build/Test/Tasty/Run.dyn_o )
[17 of 25] Compiling Test.Tasty.Ingredients ( Test/Tasty/Ingredients.hs, /Users/connorbaker/Packages/ghc_hyperopt/GHC-HyperOpt/deps/tasty/dist-newstyle/build/aarch64-osx/ghc-9.8.1/tasty-1.5/build/Test/Tasty/Ingredients.o, /Users/connorbaker/Packages/ghc_hyperopt/GHC-HyperOpt/deps/tasty/dist-newstyle/build/aarch64-osx/ghc-9.8.1/tasty-1.5/build/Test/Tasty/Ingredients.dyn_o )
[18 of 25] Compiling Test.Tasty.Options.Env ( Test/Tasty/Options/Env.hs, /Users/connorbaker/Packages/ghc_hyperopt/GHC-HyperOpt/deps/tasty/dist-newstyle/build/aarch64-osx/ghc-9.8.1/tasty-1.5/build/Test/Tasty/Options/Env.o, /Users/connorbaker/Packages/ghc_hyperopt/GHC-HyperOpt/deps/tasty/dist-newstyle/build/aarch64-osx/ghc-9.8.1/tasty-1.5/build/Test/Tasty/Options/Env.dyn_o )
[19 of 25] Compiling Test.Tasty.Ingredients.ListTests ( Test/Tasty/Ingredients/ListTests.hs, /Users/connorbaker/Packages/ghc_hyperopt/GHC-HyperOpt/deps/tasty/dist-newstyle/build/aarch64-osx/ghc-9.8.1/tasty-1.5/build/Test/Tasty/Ingredients/ListTests.o, /Users/connorbaker/Packages/ghc_hyperopt/GHC-HyperOpt/deps/tasty/dist-newstyle/build/aarch64-osx/ghc-9.8.1/tasty-1.5/build/Test/Tasty/Ingredients/ListTests.dyn_o )
[20 of 25] Compiling Test.Tasty.Ingredients.IncludingOptions ( Test/Tasty/Ingredients/IncludingOptions.hs, /Users/connorbaker/Packages/ghc_hyperopt/GHC-HyperOpt/deps/tasty/dist-newstyle/build/aarch64-osx/ghc-9.8.1/tasty-1.5/build/Test/Tasty/Ingredients/IncludingOptions.o, /Users/connorbaker/Packages/ghc_hyperopt/GHC-HyperOpt/deps/tasty/dist-newstyle/build/aarch64-osx/ghc-9.8.1/tasty-1.5/build/Test/Tasty/Ingredients/IncludingOptions.dyn_o )
[21 of 25] Compiling Test.Tasty.Ingredients.ConsoleReporter ( Test/Tasty/Ingredients/ConsoleReporter.hs, /Users/connorbaker/Packages/ghc_hyperopt/GHC-HyperOpt/deps/tasty/dist-newstyle/build/aarch64-osx/ghc-9.8.1/tasty-1.5/build/Test/Tasty/Ingredients/ConsoleReporter.o, /Users/connorbaker/Packages/ghc_hyperopt/GHC-HyperOpt/deps/tasty/dist-newstyle/build/aarch64-osx/ghc-9.8.1/tasty-1.5/build/Test/Tasty/Ingredients/ConsoleReporter.dyn_o )
Test/Tasty/Ingredients/ConsoleReporter.hs:576:13: error: [GHC-91416]
• Unbound implicit parameter (?colors::Bool)
arising from a use of ‘printStatistics’
• In a stmt of a 'do' block: _ <- printStatistics stats time
In the expression:
do stats <- computeStatistics smap
printStatistics stats time
return $ statFailures stats == 0
In a stmt of a 'do' block:
return $ \ time
-> do stats <- computeStatistics smap
printStatistics stats time
....
|
576 | printStatistics stats time
| ^^^^^^^^^^^^^^^
[23 of 25] Compiling Test.Tasty.CmdLine ( Test/Tasty/CmdLine.hs, /Users/connorbaker/Packages/ghc_hyperopt/GHC-HyperOpt/deps/tasty/dist-newstyle/build/aarch64-osx/ghc-9.8.1/tasty-1.5/build/Test/Tasty/CmdLine.o, /Users/connorbaker/Packages/ghc_hyperopt/GHC-HyperOpt/deps/tasty/dist-newstyle/build/aarch64-osx/ghc-9.8.1/tasty-1.5/build/Test/Tasty/CmdLine.dyn_o )
Error: cabal: Failed to build tasty-1.5.
You're right, it does seem to be an instance of that issue! As for the why of doing this -- I don't really have one. I'm building a project locally which I've split into many packages and I've taken the simple approach of using a cabal.projectpackage *
ghc-options: -Wall -O2 -XApplicativeDo -foptimal-applicative-do
-- Test/Tasty/Ingredients/ConsoleReporter.hs:576:13: error: [GHC-91416]
-- • Unbound implicit parameter (?colors::Bool)
-- arising from a use of ‘printStatistics’
-- • In a stmt of a 'do' block: _ <- printStatistics stats time
-- In the expression:
-- do stats <- computeStatistics smap
-- printStatistics stats time
-- return $ statFailures stats == 0
-- In a stmt of a 'do' block:
-- return $ \ time
-- -> do stats <- computeStatistics smap
-- printStatistics stats time
-- ....
-- |
-- 576 | printStatistics stats time
-- | ^^^^^^^^^^^^^^^
package tasty
ghc-options: -XNoApplicativeDo -fno-optimal-applicative-do
-- src/Hedgehog/Internal/Runner.hs:349:64: error: [GHC-83865]
-- • Couldn't match type ‘Result’ with ‘Progress’
-- Expected: Progress -> Report Progress
-- Actual: Result -> Report Result
-- • In the second argument of ‘(.)’, namely ‘mkReport’
-- In the second argument of ‘skipToShrink’, namely
-- ‘(updateUI . mkReport)’
-- In the second argument of ‘(<$>)’, namely
-- ‘skipToShrink shrinkPath (updateUI . mkReport) node’
-- |
-- 349 | mkReport <$> skipToShrink shrinkPath (updateUI . mkReport) node
-- | ^^^^^^^^
package hedgehog
ghc-options: -XNoApplicativeDo -fno-optimal-applicative-do Per 6.2.4.2. Things to watch out for
I thought it was reasonable to do so for all packages, not just my local packages because it shouldn't break anything. I submitted this PR because I thought tasty shouldn't fail to compile when You're right that this looks like a bug in GHC itself. As such, I'll close this PR. |
Unrelated, but any idea if it would be appropriate to amend https://gitlab.haskell.org/ghc/ghc/-/blob/master/docs/users_guide/exts/applicative_do.rst to mention https://gitlab.haskell.org/ghc/ghc/-/issues/20630? |
I think it's a good idea, yes. |
FWIW I seriously doubt that enabling |
Fixes the following compilation error I had seen on GHC 9.8 when building with
-XApplicativeDo
: