Skip to content

Commit 60e10c2

Browse files
committed
Re #6691 Improve documentation re Stack options
1 parent 28ee6f3 commit 60e10c2

File tree

5 files changed

+44
-22
lines changed

5 files changed

+44
-22
lines changed

doc/configure/yaml/index.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Stack's configuration options are each of one of two types:
1616

1717
- :material-account:{ .lg .middle } __Project-specific__
1818

19-
Configured at the project level
19+
Configured only at the project level
2020

2121
---
2222

@@ -32,6 +32,8 @@ Stack's configuration options are each of one of two types:
3232

3333
</div>
3434

35+
Most of Stack's configuration options are non-project specific.
36+
3537
## Project-level and global configuration files
3638

3739
Stack's configuration files are each of one of two types:

doc/configure/yaml/non-project.md

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,18 @@
22

33
# Non-project-specific configuration
44

5-
Non-project configuration options can be included in a project-level
6-
configuration file (`stack.yaml`, by default) or in global configuration files
7-
(`config.yaml`). However, non-project-specific options in the project-level
8-
configuration file in the `global-project` directory are ignored by Stack. The
9-
options below are listed in alphabetic order.
5+
Non-project configuration options can be included in:
6+
7+
* a [project-level configuration file](../yaml/index.md#project-level-and-global-configuration-files)
8+
(`stack.yaml`, by default), like [project-specific](project.md) ones; or
9+
10+
* [global configuration files](../yaml/index.md#project-level-and-global-configuration-files)
11+
(`config.yaml`).
12+
13+
However, non-project-specific options in the project-level configuration file in
14+
the `global-project` directory are ignored by Stack.
15+
16+
The options below are listed in alphabetic order.
1017

1118
## allow-different-user
1219

doc/configure/yaml/project.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
# Project-specific configuration
44

55
Project-specific configuration options are valid only in a project-level
6-
configuration file (`stack.yaml`, by default).
6+
configuration file (`stack.yaml`, by default). Most of Stack's configuration
7+
options are [non-project specific](non-project.md).
78

89
Each of the Haskell packages to which a Stack project relates is either a
910
**project package** that is part of the project and located locally or a package

doc/tutorial/cabal_flags_and_ghc_options.md

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,27 @@ command:
1515
stack build --flag yackage:-upload
1616
~~~
1717

18-
This means: when compiling the `yackage` package, turn off the `upload` flag
19-
(thus the `-` in `-upload`). Unlike other tools, Stack is explicit about which
20-
package's flag you want to change. It does this for two reasons:
18+
This means: when compiling the `yackage` package, turn off the `upload` Cabal
19+
flag (thus the `-` in `-upload`). Unlike other tools, Stack is explicit about
20+
which package's flag you want to change. It does this for two reasons:
2121

2222
1. There's no global meaning for Cabal flags, and therefore two packages can
2323
use the same flag name for completely different things.
24+
2425
2. By following this approach, we can avoid unnecessarily recompiling snapshot
25-
packages that happen to use a flag that we're using.
26+
packages that happen to use a Cabal flag that we're using.
2627

27-
You can also change flag values on the command line for extra-dep and snapshot
28-
packages. If you do this, that package will automatically be promoted to an
29-
extra-dep, since the build plan is different than what the plan snapshot
28+
You can also change Cabal flag values on the command line for extra-dep and
29+
snapshot packages. If you do this, that package will automatically be promoted
30+
to an extra-dep, since the build plan is different than what the plan snapshot
3031
definition would entail.
3132

33+
If you have Cabal flags that you will be setting regularly when building your
34+
packages, you can add them to your Stack project-level configuration file
35+
(`stack.yaml`). For more information, see the
36+
[flags](../configure/yaml/project.md#flags) project-specific configuration
37+
option documentation.
38+
3239
## GHC options
3340

3441
GHC options follow a similar logic as in managing Cabal flags, with a few
@@ -90,10 +97,13 @@ While this specific corner case does catch people by surprise, the overall goal
9097
of reproducible builds is - in the Stack maintainers' views - worth the
9198
confusion.
9299

93-
Final point: if you have GHC options that you'll be regularly passing to your
94-
packages, you can add them to your `stack.yaml` file. For more information, see
95-
the [ghc-options](../configure/yaml/non-project.md#ghc-options) non-project
96-
specific configuration option documentation.
100+
If you have GHC options that you will be applying regularly when building your
101+
packages, you can add them to your Stack project-level configuration file
102+
(`stack.yaml`) or (if applicable) to a
103+
[global Stack configuration file](../configure/yaml/index.md#project-level-and-global-configuration-files).
104+
For more information, see the
105+
[ghc-options](../configure/yaml/non-project.md#ghc-options) non-project specific
106+
configuration option documentation.
97107

98108
!!! note
99109

doc/tutorial/project_configuration.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,13 @@ is the `stack.yaml` file.
2525
## `stack.yaml`
2626

2727
Stack requires a Stack project-level configuration file for every project.
28-
`stack.yaml` is that file. The contents of the file define project-specific
29-
options and non-project-specific options that apply to the project.
28+
`stack.yaml` is that file. The contents of the file set project-specific and
29+
non-project-specific options that apply to the project. (Non-project
30+
specific options that affect the project may also be set in a
31+
[global Stack configuration file](../configure/yaml/index.md#project-level-and-global-configuration-files).)
3032

31-
The contents of the file include comments beginning `#`. Ignoring those
32-
comments, the contents will look something like this:
33+
The contents of the `stack.yaml` file include comments beginning `#`. Ignoring
34+
those comments, the contents will look something like this:
3335

3436
~~~yaml
3537
snapshot:

0 commit comments

Comments
 (0)