6. Installed package databases¶
Time to take a short break from hands-on examples and discuss a little architecture. Stack has the concept of multiple databases.
A database consists of a GHC package database (which contains the compiled
version of a library), executables, and a few other things as well. To give you
an idea, the contents of the parent directory of the stack path --local-pkg-db
directory are the directories:
Databases in Stack are layered. For example, the database listing we just gave is called a local database (also known as a mutable database). That is layered on top of a snapshot database (also known as a write-only database). The snapshot database contains the libraries and executables that are considered to be immutable. Finally, GHC itself ships with a number of libraries and executables, also considered to be immutable, which forms the global database.
To get a quick idea of this, we can look at the output of the
stack exec -- ghc-pkg list command in our helloworld project: