Stack ghci on a component of a package does not cause the library component to be built
mgsloan opened this issue · 2 comments
mgsloan commented
Repro: Run stack ghci :store-test on store (after stack clean)
Result:
store-0.3: configure (lib)
Configuring store-0.3...
store-0.3: initial-build-steps (lib)
The following GHC options are incompatible with GHCi and have not been passed to it: -O2 -threaded
Configuring GHCi with the following packages: store
Using main module: 1. Package `store' component test:store-test with main-is file: /home/mgsloan/fpco/store/test/Spec.hs
GHCi, version 7.10.3: http://www.haskell.org/ghc/ :? for help
<command line>: cannot satisfy -package store-0.3
(use -v for more information)
The issue is that it needs to build the library in order to be able to load these auxiliary components.
For now, the workaround is to either do a stack build first, or load both the library and the component into ghci.
mpilgrem commented
This still appears to be an issue with Stack 2.15.5 and store-0.7.18:
> stack unpack store
> cd store-*
> stack init
> stack ide targets
> stack ghci store:test:store-test
...
Configuring GHCi with the following packages: store.
Progress 65/66GHCi, version 9.6.4: https://www.haskell.org/ghc/ :? for help
<command line>: cannot satisfy -package store-0.7.18
(use -v for more information
> stack build
> stack ghci store:test:store-test
...
<no location info>: error:
Could not find module ‘Data.StoreSpec’
Perhaps you meant
Data.Store (from store-0.7.18)
Data.Store.TH (from store-0.7.18)
Loaded GHCi configuration from C:\Users\mike\AppData\Local\stack\ghci-script\2b6af032\ghci-script
ghci>