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

时间:2015-10-31 00:00:46

标签: haskell haskell-stack

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?

1 个答案:

答案 0 :(得分:22)

  

这是否意味着该项目已设置为仅使用在LTS-3.8下验证的软件包和版本?

完全。 (如果您需要未包含在LTS 3.8集中的软件包,您可以通过extra-deps的{​​{1}}部分指定它们。栈将从Hackage中获取它们并为您的项目单独安装它们,而不会影响LTS快照或您的其他项目。)

  

如果我现在想要开始一个新项目并希望在新项目中使用最新的LTS版本,我如何告诉堆栈默认执行此操作?

使用例如stack.yaml为新项目设置解析器。堆栈默认为您已经使用的最新LTS快照,因此,一旦您拥有最新LTS的项目,未来的新项目将会效仿。

  

如果我想要"升级"一个较旧的项目使用新的LTS版本?

更改stack new projectname --resolver=lts-3.11文件中的resolver字段。更改将在您下次构建项目时生效。