简体   繁体   中英

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.

Is there a way to specify this fact in the stack.yaml itself? Or is there an idiom for expressing this there. I'd like to simply omit resolver from the file, but that's not allowed.

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. 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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