32

I am trying to understand how to use stack and stackage.org. When I first installed it and used it, stackage.org was at LTS-3.8 (the "resolver"). Since then, stackage.org now has LTS-3.11.

First, I'd like to confirm what this means. Stackage is a repository of packages in which, for a specific LTS version (say 3.8), the packages have been verified to work together. So the packages of LTS-3.8 work together, and the packages of LTS-3.11 also work together. Moving on ...

When I run stack new projectname, stack tells me:

Checking against build plan lts-3.8
Selected resolver: lts-3.8

Does this mean that the project has been set up to use only the packages and versions that were verified under LTS-3.8?

If I now want to start a new project and want to use the latest LTS version with the new project, how do I tell stack to do that by default?

What about if I want to "upgrade" an older project to use a new LTS version?

duplode
  • 33,731
  • 7
  • 79
  • 150

1 Answers1

32

Does this mean that the project has been set up to use only the packages and versions that were verified under LTS-3.8?

Exactly. (And if you ever need packages not included in the LTS 3.8 set you can specify them through the extra-deps section of stack.yaml. stack will grab them from Hackage and install them separately for your project, without affecting the LTS snapshot or your other projects.)

If I now want to start a new project and want to use the latest LTS version with the new project, how do I tell stack to do that by default?

Use e.g. stack new projectname --resolver=lts-3.11 to set the resolver for a new project. stack defaults to the most recent LTS snapshot you are already using, and so once you have a project with the latest LTS future new projects will follow suit.

What about if I want to "upgrade" an older project to use a new LTS version?

Change the resolver field in the stack.yaml file. The change will take effect the next time you build the project.

duplode
  • 33,731
  • 7
  • 79
  • 150