CardanoSolutions/kupo

`cabal repl` doesn't load kupo modules in presence of -Wunused-packages option

Closed this issue · 1 comments

What Git revision are you using?

28af7fc8a6efe358c1c0f8dc1fb6d9f62dd4279f

What operating system are you using, and which version?

  • Linux / Ubuntu
  • Linux / Other
  • OSX
  • Windows

Describe what the problem is?

cabal repl doesn't load any of Kupo modules.

$ cabal --version; ghc --version
cabal-install version 3.6.2.0
compiled using version 3.6.2.0 of the Cabal library 
The Glorious Glasgow Haskell Compilation System, version 8.10.7

$ cabal repl                                                                                                                   
Warning: Requested index-state 2022-02-18T00:00:00Z is newer than
'hackage.haskell.org'! Falling back to older state (2022-02-17T23:17:49Z).
Resolving dependencies...
Build profile: -w ghc-8.10.7 -O1
In order, the following will be built (use -v for more details):
 - kupo-2.0.0 (lib) (configuration changed)
Configuring library for kupo-2.0.0..
Preprocessing library for kupo-2.0.0..
GHCi, version 8.10.7: https://www.haskell.org/ghc/  :? for help
Loaded GHCi configuration from /home/wrover/.ghc/ghci.conf
*** Exception: The following packages were specified via -package or -package-id flags,
but were not needed for compilation:
  - yaml-0.11.7.0
... all packages...
  - aeson-2.0.2.0

λ> 

What should be the expected behavior?

cabal repl loads all modules from lib:kupo

Solution

I found that the issue is gone if -Wunused-packages is removed. The problem is that I was unable to reproduce this behaviour, so I guess it interferes with something else. One of the possible solutions would be hiding this option behind a flag, but surely it's more kind of WA.

KtorZ commented

Thanks for reporting. That is, quite strange and I think and odd behavior of cabal or ghci at play here. I've moved the warning to be only enabled when the +production flag is on, and removed that default flag from the cabal.project. The CI and Makefile do make explicitly use of the flag anyway.

This solves it and the repl can now be started as expected. Yet, still not sure why ghci is choking on that 🤷