cabal icon indicating copy to clipboard operation
cabal copied to clipboard

Cabal multi-repl doesn't consider ghc-options in cabal.project

Open pranaysashank opened this issue 1 year ago • 2 comments

Describe the bug When using cabal with multi-repl feature enabled, cabal doesn't pass ghc-options defined in cabal.project either under the specific package <package-name> or under program-options

To Reproduce Steps to reproduce the behavior:

  1. Clone the repo https://github.com/pranaysashank/cabal-multi-repl-bug
  2. Run cabal repl all, notice the error about ExplicitNamespaces
  3. Enable TypeFamilies or ExplicitNamespaces on top of the MyLib module in foo/src/MyLib.hs
  4. Run cabal repl all again and notice it loads fine

Expected behavior A clear and concise description of what you expected to happen.

Multi-repl should consider ghc-options just the same as normal repl, I also think the release should be on hold until this issue is fixed.

System information

  • Operating system: nixos
  • cabal, ghc versions: 3.11, 9.8.2

Additional context Add any other context about the problem here.

  • This affects haskell-language-server as well when used in multi-repl mode
  • We enable a bunch of ghc-options under program-options in cabal.project to enable them for all packages at once, so it'd be nice if multi repl works with this as well.

pranaysashank avatar May 16 '24 08:05 pranaysashank

I put up a fix in #10017

Someone should add your example as a test, thanks for providing a nice minimal reproducer.

mpickering avatar May 16 '24 13:05 mpickering

@mpickering thanks for the quick fix, I can confirm it works. I have a new issue: when the ghc-options field contains +RTS <options> -RTS this seems to break the parser and I get the error: target +RTS is not a module or a source file. I guess this should be a hls bug, since everything works fine with cabal repl all (my only compliant is it's very slow to begin compilation)

pranaysashank avatar May 16 '24 14:05 pranaysashank