Closed
Description
Describe the bug
cabal build
successfully builds the cabal project, which uses build-type: Configure
with <package>.buildinfo
and CPP definition in it.
But cabal repl
fails:
$ cabal repl
Build profile: -w ghc-9.2.8 -O1
In order, the following will be built (use -v for more details):
- cabal-buildinfo-example-0.1.0.0 (ephemeral targets)
Preprocessing library for cabal-buildinfo-example-0.1.0.0..
GHCi, version 9.2.8: https://www.haskell.org/ghc/ :? for help
[1 of 1] Compiling MyLib ( src/MyLib.hs, interpreted )
src/MyLib.hs:6:14: error:
Data constructor not in scope: MYDEF :: String
|
6 | definition = MYDEF
| ^^^^^
Failed, no modules loaded.
Remarkably, nix build
fails the same way!
To Reproduce
Steps to reproduce the behavior:
$ git clone https://github.com/alexoundos/cabal-buildinfo-example
$ cd cabal-buildinfo-example
$ nix develop
[devshell]$ cabal build
[devshell]$ cabal run
[devshell]$ cabal repl
Expected behavior
Generated <project>.buildinfo
file must be respected in cabal repl
(and nix build
).
System information
- Operating system: tested on Linux (NixOS 23.05)
cabal
: v3.10.1.0ghc
: v9.2.8
Additional context
This issue was already reported: #4195, haskell/haskell-language-server#3780.