6

I've decided to try giving stack a shot. I've installed it and used it to install the latest version of ghc. I've used stack to install some packages but the packages are not visible to ghc and when I list packages with ghc-pkg I see that the packages that I've installed through stack are not there. Why is this? Am I misunderstanding the purpose of stack?

phadej
  • 11,947
  • 41
  • 78
user467526
  • 517
  • 5
  • 19

1 Answers1

8

Stack never touches global packages database. It uses layered database approach

  1. global database - untouched
  2. packages in the stackage snapshot are installed into snapshot database
  3. other packages are installed locally per project

Thus instead of polluting global database, most packages are installed in snapshot database(s), so most packages can be shared. As packages in stackage snapshots are compatible (i.e. always compile together), we don't run into Cabal hell.

You can use stack ghci or stack ghc to run corresponding commands with package database configured.

The more precise explanation is in the stack wiki

phadej
  • 11,947
  • 41
  • 78