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?
stack ghci allows you to load components and files of your project into ghci . It uses the same TARGET syntax as stack build , and can also take options like --test , --bench , and --flag . Similarly to stack build , the default is to load up ghci with all libraries and executables in the project.
html -> click on system information-> login with admin rights -> you can get all details about the installed server.
To build your project, Stack uses a project-level configuration file, named stack. yaml , in the root directory of your project as a sort of blueprint. That file contains a reference, called a resolver, to the snapshot which your package will be built against.
In its default configuration, Stack will simply ignore any system GHC installation and use a sandboxed GHC that it has installed itself. You can find these sandboxed GHC installations in the ghc-* directories in the stack path --programs directory.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With