Skip to content

Commit 97563a0

Browse files
committed
Merge pull request #2185 from sid-kap/yaml-configuration-document-shadowing
Edit "Yaml Configuration" page in documention
2 parents 2c04bd3 + ed6e8dd commit 97563a0

File tree

1 file changed

+33
-6
lines changed

1 file changed

+33
-6
lines changed

doc/yaml_configuration.md

Lines changed: 33 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,48 @@
22

33
This page is intended to fully document all configuration options available in the stack.yaml file. Note that this page is likely to be both *incomplete* and sometimes *inaccurate*. If you see such cases, please update the page, and if you're not sure how, open an issue labeled "question".
44

5-
The stack.yaml configuration options break down into [project specific](#project-config) options in:
5+
The stack.yaml configuration options break down into [project-specific](#project-config) options in:
66

77
- `<project dir>/stack.yaml`
88

9-
and [non-project specific](#non-project-config) options in:
9+
and [non-project-specific](#non-project-config) options in:
1010

1111
- `/etc/stack/config.yaml` -- for system global non-project default options
1212
- `~/.stack/config.yaml` -- for user non-project default options
1313
- The project file itself may also contain non-project specific options
1414

1515
*Note:* When stack is invoked outside a stack project it will source project specific options from `~/.stack/global/stack.yaml`. Options in this file will be ignored for a project with its own `<project dir>/stack.yaml`.
1616

17-
## Project config
18-
19-
Project specific options are only valid in the `stack.yaml` file local to a project, not in the user or global config files.
17+
## Project-specific config
18+
19+
Project-specific options are only valid in the `stack.yaml` file local to a project, not in the user or global config files.
20+
21+
> Note: We define **project** to mean a directory that contains a `stack.yaml`
22+
> file. We define **package** the same way that Cabal defines a package. (This
23+
> means a single `.cabal` file---which may contain a library, a test suite, and
24+
> multiple executables.) Note that a single **Stack project** may contain
25+
> several **packages**---which might be located in a directory on your
26+
> computer, on Hackage, in a remote Git or Mercurial repository, or even in a
27+
> tarball somewhere on the internet.
28+
29+
In your project-specific options, you specify both **which of your packages**
30+
to build and **which dependencies to use** when building these packages. Stack
31+
treats _packages_ and _dependencies_ differently. For dependencies, Stack only
32+
builds the library part, while for packages Stack builds the library, the
33+
executables, and the test suite.
34+
35+
The below sections will show you how to tell Stack where to find your packages
36+
and dependencies.
37+
38+
Note that, using the options described below, it **is possible** to specify in
39+
your `stack.yaml` multiple sources of the same package/dependency. For example,
40+
you might specify a version of a project on your local machine, a Stackage
41+
snapshot that contains the same package, as well as a version of the same
42+
package on Hackage. For simplicity, **Stack will only use one version of each
43+
package/dependency.** There are rules that dictate how Stack chooses which
44+
version to use. Read [the section on
45+
"shadowing"](http://docs.haskellstack.org/en/stable/architecture/#shadowing) to
46+
learn more about these rules.
2047

2148
### packages
2249

@@ -222,7 +249,7 @@ as a reminder for the user to review the configuration and make any changes if
222249
needed. The user can delete this message if the generated configuration is
223250
acceptable.
224251

225-
## Non-project config
252+
## Non-project-specific config
226253

227254
Non-project config options may go in the global config (`/etc/stack/config.yaml`) or the user config (`~/.stack/config.yaml`).
228255

0 commit comments

Comments
 (0)