Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Understanding Haskell's stack program and the resolver and LTS version

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?

like image 996
Ana Avatar asked Oct 31 '15 00:10

Ana


People also ask

What is stack Ghci?

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.

How do I know if stack is installed?

html -> click on system information-> login with admin rights -> you can get all details about the installed server.

How do you create a project stack?

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.

Where does stack install GHC?

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.


1 Answers

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.

like image 98
duplode Avatar answered Sep 19 '22 16:09

duplode