I'd like to have a simple way of ensuring that the packages in my system, whether they are in the global or the user package database, correspond to the versions in the current LTS Haskell.
I gather that there are fairly simple ways to do something like this for a specific project. But it's not clear to me how to achieve this for my Haskell system as a whole. I have Stack installed already (using Cabal), and use Homebrew where I can (e.g., for Haskell, just for cabal-install
). I'm tempted by haskell-stack
, but it's unclear what exactly that does.
Is there a simple way to ensure that my system's Haskell packages (wherever they reside) match LTS Haskell?
If you're using cabal-install, your best bet is to append the contents of https://www.stackage.org/lts-3.8/cabal.config?global=true (adjust the LTS snapshot slug to your preference) to your ~/.cabal/config
. I'd caution against doing this, though, since you may well want to use different snapshots for different projects. Use of sandboxes with cabal-install is highly recommended (in fact, I set require-sandbox: true
in my cabal config to make sure I don't forget).
For Stack, the LTS snapshot is always project-specific; there is no global setting. But setting the resolver:
value in ~/.stack/global/stack.yaml
sets it for when you run stack
outside of a specific project, and also influences the choice of resolver for new projects (when you use stack init
or stack new
).
BTW, it looks like the Homebrew haskell-stack
formula is just an alternate way to install Stack, so if you already have Stack there's no need to use it.