了解Haskell的堆栈程序以及解析器和LTS版本 [英] Understanding Haskell's stack program and the resolver and LTS version
问题描述
我想了解如何使用 stack和stackage.org 。当我第一次安装并使用它时,stackage.org在LTS-3.8(解析器)。从那以后,stackage.org现在有LTS-3.11。
首先,我想确认这意味着什么。堆栈是一个软件包的存储库,其中对于特定的LTS版本(比如3.8),软件包已经过验证可以一起工作。所以LTS-3.8的软件包一起工作,而LTS-3.11的软件包也可以一起工作。继续...
当我运行 stack new projectname
时,堆栈告诉我:
检查构建计划lts-3.8
选择的解析器:lts-3.8
这是否意味着该项目已设置为仅使用经过LTS-3.8验证的软件包和版本?
如果我现在想要启动一个新项目,并希望在新项目中使用最新的LTS版本,那么默认情况下我该如何告诉堆栈?
如果我想升级一个较旧的项目以使用新的LTS版本,那么该怎么办?
这是否意味着该项目已经设置为仅使用经过LTS-3.8验证的软件包和版本?
没错。 (如果你需要的软件包不包含在LTS 3.8中,你可以通过 extra.deps
部分指定它们。 stack.yaml
。stack将从Hackage中抓取它们,并将它们分别安装到您的项目中,而不会影响LTS快照或其他项目。)
如果我现在想要开始一个新项目,并希望在新项目中使用最新的LTS版本,那么默认情况下我该如何告诉堆栈?
使用例如 stack new projectname --resolver = lts-3.11
设置新项目的解析器。堆栈默认为您已经使用的最新的LTS快照,因此,一旦您有了最新的LTS项目,未来的新项目将会跟随。
如果我想升级一个较旧的项目以使用新的LTS版本,那么怎么办?
更改 resolver
字段放在 stack.yaml
文件中。该更改将在您下次构建项目时生效。
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?
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.
这篇关于了解Haskell的堆栈程序以及解析器和LTS版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!