I'm trying to install the sbv
module https://hackage.haskell.org/package/sbv
Installation with Stack works great (no errors):
stack install sbv
but then I cannot import the corresponding module in stack ghci
:
import Data.SBV
-- <no location info>: error:
-- Could not find module ‘Data.SBV’
-- Perhaps you meant Data.Set (from containers-0.6.2.1)
Now, when I try with Cabal instead:
cabal new-install sbv --lib
Everything runs smoothly on ghci
import Data.SBV
prove $ \x -> x `shiftL` 2 .== 4 * (x::SWord8)
--- Q.E.D. (<-- this is the expected output)
However, still no luck with stack ghci
(same error as before). This is the case whether stack install sbv
was done globally or in the context of a Stack project.
Is there a way to make sbv
work with the Stack installation (even if it was installed via cabal)?
stack ghci --package sbv
, or use:set -package sbv
within GHCi to make an installed package visible, although note that changing the package flags will reset your session. If you have several dependencies like this, it becomes much easier to list them in a project file so they’re available automatically. – Jon Purdy.cabal
file, as @leftaroundabout suggested, or astack.yaml
file to mention dependencies? – Jivan.cabal
orpackage.yaml
file specifies the direct dependencies of your own project without worrying about which particular versions of libraries actually work together, whereasstack.yaml
specifies one concrete configuration that's known to work and where to get the packages from. In principle the.cabal
file is enough, butstack.yaml
can make your project more portable and future proof. – leftaroundabout