ghc only knows about packages that are installed. Installed packages live in package databases
ghc-pkg is package tool from ghc and ghc know two database
database is a directory, usually called package.conf.d, that contains a file for each package, together with a binary cache of the package data in the file package.cache
global package database, which comes with your GHC installation, e.g. /usr/lib/ghc-6.12.1/package.conf.d.
user package database private to each user, e.g. $XDG_DATA_HOME/ghc/arch-os-version/package.conf.
While we assume in general that LTS snapshots never change, there's nothing that technically prohibits that from happening. Instead, the complete version of that field is
The only issue is how to distinguish flags to be passed to stack versus those for the underlying program. Thanks to the optparse-applicative library, stack follows the Unix convention of -- to separate these, e.g.:
stack exec --package stm -- echo I installed the stm package via --package stm
"--package foo" can be used to force a package to be installed before running the given command