简体   繁体   English

Cabal + Stack:在cabal文件中指定软件包版本

[英]Cabal + Stack: specifying the packages version in the cabal file

Normally when adding a new dependency to a .cabal file I specify the version of the new library I'm depending on. 通常,当向.cabal文件中添加新的依赖项时,我会指定我所依赖的新库的版本。 However stack works with a curated set of libraries, and I'm wondering whether it makes sense to specify the package versions in the .cabal file. 但是stack可与一组.cabal的库一起使用,我想知道在.cabal文件中指定软件包版本是否有意义。 My guess would be that specifying the lts version in the stack.yaml is enough. 我的猜测是,指定lts的版本stack.yaml就足够了。

I'm wondering whether it makes sense to specify the package versions in the .cabal file. 我想知道在.cabal文件中指定软件包版本是否有意义。

That depends completely upon you. 那完全取决于你。 If you specify a package version which is not in that particular stackage resolver, then Stack will throw an error saying you to adjust the versioning. 如果您指定的软件包版本不在该特定的堆栈解析器中,则Stack会引发错误,提示您调整版本。

My guess would be that specifying the lts version in the stack.yaml is enough. 我的猜测是在stack.yaml中指定lts版本就足够了。

For private packages, it doesn't matter and I prefer not putting any version bounds there. 对于私有软件包,这并不重要,我更喜欢在此不放置任何版本限制。 But if it's something I ultimately plan to publish on Hackage, I usually use a CI system like Travis and get the bounds right for it with some testing. 但是,如果我最终打算在Hackage上发布它,我通常会使用Travis之类CI系统 ,并通过一些测试来确定界限。 In fact, I think the Stack guide recommends something like that. 实际上,我认为Stack指南建议采用类似的方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM