简体   繁体   English

我可以在我的stack.yaml中省略或为“ resolver”指定一个“虚拟”值吗?

[英]Can I omit or specify a “dummy” value for 'resolver' in my stack.yaml

I am using stack.yaml files in conjunction with a specified --resolver so that the resolver key in stack.yaml is (or should be) always ignored. 我使用stack.yaml与指定相结合的文件--resolver从而使resolver在关键stack.yaml是(或者应该是)总是被忽略。

Is there a way to specify this fact in the stack.yaml itself? 有没有办法在stack.yaml本身中指定这个事实? Or is there an idiom for expressing this there. 还是在那里有表达这个习惯的习语。 I'd like to simply omit resolver from the file, but that's not allowed. 我只想从文件中省略resolver ,但这是不允许的。

It is not idiomatic to do things this way with stack, but you can put anything in the resolver field, and it will be ignored by stack if you supply the --resolver flag. 用堆栈以这种方式处理事务并不是惯用的,但是您可以将任何内容放在resolver字段中,如果提供--resolver标志,则它将被堆栈忽略。 For example: 例如:

$ cat stack.yaml
# stack.yaml
resolver: none
packages: []
extra-deps:
- tardis-0.2.0.0

$ stack repl
Unable to load custom resolver none from local file:
  /Users/dan/scratch/stack-no-resolver-test/none
Exception: InvalidYaml (Just (YamlException "Yaml file not found: /Users/dan/scratch/stack-no-resolver-test/none"))

 $ stack --resolver lts-12.0 repl
...
Configuring GHCi with the following packages:
GHCi, version 8.4.3: http://www.haskell.org/ghc/  :? for help 

You just have to be able to understand that the "unable to load custom resolver none" error message, for your use case, means that you forgot to supply --resolver on the command line. 您只需要能够了解针对您的用例的“无法加载自定义解析器无”错误消息,就意味着您忘记了在命令行上提供--resolver

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

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