Haskell Language Stack Stackage Packages and changing the LTS (resolver) version


Stackage is a repository for Haskell packages. We can add these packages to a stack project.

Adding lens to a project.

In a stack project, there is a file called stack.yaml. In stack.yaml there is a segment that looks like:

resolver: lts-6.8

Stackage keeps a list of packages for every revision of lts. In our case we want the list of packages for lts-6.8 To find these packages visit:

https://www.stackage.org/lts-6.8 # if a different version is used, change 6.8 to the correct resolver number.

Looking through the packages, there is a Lens-4.13.

We can now add the language package by modifying the section of helloworld.cabal:

  build-depends: base >= 4.7 && < 5


  build-depends: base >= 4.7 && 5,
                 lens == 4.13

Obviously, if we want to change a newer LTS (after it's released), we just change the resolver number, eg.:

resolver: lts-6.9

With the next stack build Stack will use the LTS 6.9 version and hence download some new dependencies.