commercialhaskell / commercialhaskell/stack
Method to combine multiple project stack.yaml files
- Dominant language
- Haskell
- Stars
- 4.1k
- Forks
- 850
- Avg merge
- 10h 37m
- Merged PRs (30d)
- 4
Description
A I understand it, `stack.yaml` is a passive/declarative format. It doesn't have any executable or expanded bits, or `#include` syntax, or whatever. That's all well and good, but it does seem to leave us doing ad-hoc `cat` commands on fragments of `stack.yaml` to build the right one.
In particular this comes up when _varying things_. Like a really simple example would be to build in docker and non-docker environments (and multiple resolvers of course). Currently, we would put the normal base config in `stack.yaml`, and then have a separate file, say `enable_docker.yaml`, with just this entry:
``` yaml
docker:
enable: true
repo: ...
```
Then we could build by running:
``` bash
$ cat stack.yaml enable_docker.yaml > stack2.yaml
$ stack --stack-yaml=stack2.yaml build
```
This is ok, but it is kind of ugly/messy, and it doesn't scale super well. If we had command line arguments for all the docker config bits, we could vary this by varying the command line arguments, but we currently don't.
Initially, by the way, I kind of thought the following might work:
``` bash
$ stack --stack-yaml=stack.yaml --stack-yaml=enable_docker.yaml build
```
But currently this is an error.
Internally, there's already the ability to combine configs (Monoid), right? And we already mix configs from global / user / project. So the restriction to only mix exactly those three configs seems a bit arbitrary.
This is somewhat related to #392 and #378.
Contributor guide
Assessment
This issue has not been assessed yet.