I wanted to set some custom compiler flags for all stack-compiled packages on my machine (more aggressive optimizations than the defaults), and following the stack guide , I added some ghc-options
(applying to "$everything"
) to my ~/.stack/config.yaml
. These flags were properly applied to stack
invocations outside of any project directory.
Within project directories, however, the stack.yaml
options don't just take precedence; everything in ~/.stack/config.yaml
is completely ignored! I have no ghc-options
specified in any project-local stack.yaml
files, but those specified ~/.stack/config.yaml
have no effect.
The stack
documentation would seem to suggest that options should collapse, as I had expected them to:
stack has two layers of configuration: project and non-project. All of these are stored in stack.yaml files, but the former has extra fields (resolver, packages, extra-deps, and flags). The latter can be monoidally combined so that a system config file provides defaults, which a user can override with ~/.stack/config.yaml, and a project can further customize.
Unless I have a very different idea of what "customize" means, this isn't the behavior I'm observing. Is there something I'm doing incorrectly, or is the documentation misleading in this respect?
Yup, I consider this to be a bug. I have a PR that hasn't been merged yet that fixes it https://github.com/commercialhaskell/stack/pull/3781
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.