Skip to content

Commit 6c3fe8d

Browse files
committed
Merge branch 'stable'
2 parents 5f19599 + 3ad2d0e commit 6c3fe8d

File tree

5 files changed

+232
-95
lines changed

5 files changed

+232
-95
lines changed

doc/GUIDE.md

Lines changed: 78 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -1665,79 +1665,85 @@ for future uses of Stack:
16651665

16661666
## Comparison to other tools
16671667

1668-
Stack is not the only tool around for building Haskell code. Stack came into
1669-
existence due to limitations with some of the existing tools. If you're
1670-
unaffected by those limitations and are happily building Haskell code, you may
1671-
not need Stack. If you're suffering from some of the common problems in other
1672-
tools, give Stack a try instead.
1673-
1674-
If you're a new user who has no experience with other tools, we recommend going
1675-
with Stack. The defaults match modern best practices in Haskell development, and
1676-
there are less corner cases you need to be aware of. You *can* develop Haskell
1677-
code with other tools, but you probably want to spend your time writing code,
1678-
not convincing a tool to do what you want.
1679-
1680-
Before jumping into the differences, let me clarify an important similarity:
1681-
1682-
__Same package format.__ Stack, Cabal (the tool), and presumably all other tools
1683-
share the same underlying Cabal package format, consisting of a Cabal file,
1684-
modules, etc. This is a Good Thing: we can share the same set of upstream
1685-
libraries, and collaboratively work on the same project with Stack, Cabal (the
1686-
tool), and NixOS. In that sense, we're sharing the same ecosystem.
1687-
1688-
Now the differences:
1689-
1690-
* __Curation vs dependency solving as a default__.
1691-
* Stack defaults to using curation (Stackage snapshots, LTS Haskell,
1692-
Nightly, etc) as a default instead of defaulting to dependency solving, as
1693-
Cabal (the tool) does. This is just a default: as described above, Stack
1694-
can use dependency solving if desired, and Cabal (the tool) can use
1695-
curation. However, most users will stick to the defaults. The Stack team
1696-
firmly believes that the majority of users want to simply ignore
1697-
dependency resolution nightmares and get a valid build plan from day one,
1698-
which is why we've made this selection of default behavior.
1699-
* __Reproducible__.
1700-
* Stack goes to great lengths to ensure that `stack build` today does the
1701-
same thing tomorrow. Cabal (the tool) does not: build plans can be
1702-
affected by the presence of pre-installed packages, and running
1703-
`cabal update` can cause a previously successful build to fail. With
1704-
Stack, changing the build plan is always an explicit decision.
1705-
* __Automatically building dependencies__.
1706-
* With Cabal (the tool), you need to use `cabal install` to trigger
1707-
dependency building. This is somewhat necessary due to the previous point,
1708-
since building dependencies can, in some cases, break existing installed
1709-
packages. So for example, in Stack, `stack test` does the same job as
1710-
`cabal install --run-tests`, though the latter *additionally* performs an
1711-
installation that you may not want. The closer equivalent command sequence
1712-
is: `cabal install --enable-tests --only-dependencies`,
1713-
`cabal configure --enable-tests`, `cabal build && cabal test` (newer
1714-
versions of Cabal (the tool) may make this command sequence shorter).
1715-
* __Isolated by default__.
1716-
* This has been a pain point for new Stack users. In Cabal, the default
1717-
behavior is a non-isolated build where working on two projects can cause
1718-
the user package database to become corrupted. The Cabal solution to this
1719-
is sandboxes. Stack, however, provides this behavior by default via its
1720-
databases. In other words: when you use Stack, there's __no need for
1721-
sandboxes__, everything is (essentially) sandboxed by default.
1722-
1723-
__Other tools for comparison (including active and historical)__
1724-
1725-
* [cabal-dev](https://hackage.haskell.org/package/cabal-dev). This is deprecated
1726-
in favor of Cabal (the tool).
1668+
Stack is not the only tool available for building Haskell code. Stack came into
1669+
existence due to limitations at that time with some of the existing tools. If
1670+
you are happily building Haskell code with other tools, you may not need Stack.
1671+
If you're experiencing problems with other tools, give Stack a try instead.
1672+
1673+
If you're a new user who has no experience with other tools, we recommend Stack.
1674+
The defaults match modern best practices in Haskell development, and there are
1675+
fewer corner cases you need to be aware of. You *can* develop Haskell code with
1676+
other tools, but you probably want to spend your time writing code, not
1677+
convincing a tool to do what you want.
1678+
1679+
### Underlying package format
1680+
1681+
Before turning to differences, we clarify an important similarity: Stack, Cabal
1682+
(the tool), and presumably all other tools share the same underlying package
1683+
format of Cabal (the library). This is a Good Thing: we can share the same set
1684+
of upstream libraries, and collaboratively work on the same project with Stack,
1685+
Cabal (the tool), and NixOS. In that sense, we're sharing the same ecosystem.
1686+
1687+
### Curation vs dependency solving
1688+
1689+
* Stack uses 'curation' (snapshots and Stack's project-level configuration file
1690+
(`stack.yaml`) define precisely the set of packages available for a project).
1691+
The Stack team firmly believes that the majority of users want to simply
1692+
ignore dependency resolution nightmares and get a valid build plan from day
1693+
one. That's why we've made 'curation' the focus of Stack.
1694+
1695+
* Cabal (the tool) can use 'curation' too but its origins are in dependency
1696+
solving.
1697+
1698+
### Emphasis on reproducibility
1699+
1700+
* Stack goes to great lengths to ensure that `stack build` today does the
1701+
same thing tomorrow. With Stack, changing the build plan is always an explicit
1702+
decision.
1703+
1704+
* Cabal (the tool) does not go to the same lengths: build plans can be affected
1705+
by the presence of pre-installed packages, and running `cabal update` can
1706+
cause a previously successful build to fail.
1707+
1708+
### Automatic building of dependencies
1709+
1710+
* Stack's automatically builds dependencies. So for example, in Stack,
1711+
`stack test` does the same job as:
1712+
1713+
~~~text
1714+
cabal install --enable-tests --only-dependencies
1715+
cabal configure --enable-tests
1716+
cabal build
1717+
cabal test
1718+
~~~
1719+
1720+
(newer versions of Cabal (the tool) may make this command sequence shorter).
1721+
1722+
* With Cabal (the tool), you need to use `cabal install` to trigger dependency
1723+
building. This is somewhat necessary as building dependencies can, in some
1724+
cases, break existing installed packages.
1725+
1726+
### Isolation
1727+
1728+
* Stack is isolated - provides 'sandboxed' behaviour - by default, via its
1729+
databases. In other words: when you use Stack, there's
1730+
__no need for sandboxes__, everything is (essentially) sandboxed by default.
1731+
1732+
* With Cabal (the tool), the default behavior is a non-isolated build where
1733+
working on two projects can cause the user package database to become
1734+
corrupted. The Cabal solution to this is sandboxes.
1735+
1736+
### Tools other than Stack and Cabal (the tool)
1737+
17271738
* [cabal-meta](https://hackage.haskell.org/package/cabal-meta) inspired a lot of
1728-
the multi-package functionality of Stack. If you're still using Cabal (the
1729-
tool), `cabal-meta` is relevant. For Stack work, the feature set is fully
1730-
subsumed by Stack.
1731-
* [cabal-src](https://hackage.haskell.org/package/cabal-src) is mostly
1732-
irrelevant in the presence of both Stack and Cabal sandboxes, both of which
1733-
make it easier to add additional package sources easily. The mega-sdist
1734-
executable that ships with cabal-src is, however, still relevant. Its
1735-
functionality may some day be folded into Stack
1736-
* [stackage-cli](https://hackage.haskell.org/package/stackage-cli) was an
1737-
initial attempt to make Cabal (the tool) work more easily with curated
1738-
snapshots, but due to a slight impedance mismatch between cabal.config
1739-
constraints and snapshots, it did not work as well as hoped. It is deprecated
1740-
in favor of Stack.
1739+
the multi-package functionality of Stack. Still relevant for Cabal (the
1740+
tool).
1741+
* [cabal-src](https://hackage.haskell.org/package/cabal-src). Deprecated in
1742+
favor of Stack in 2016.
1743+
* [stackage-cli](https://hackage.haskell.org/package/stackage-cli).Deprecated
1744+
in favor of Stack in 2015.
1745+
* [cabal-dev](https://hackage.haskell.org/package/cabal-dev). Deprecated in
1746+
favor of Cabal (the tool) in 2013.
17411747
17421748
## More resources
17431749

doc/build_command.md

Lines changed: 47 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -247,22 +247,53 @@ the `--watch-all` flag.
247247

248248
Default: Enabled
249249

250-
Set the flag to have the output of all packages being built scroll by in a
251-
streaming fashion. The output from each package built will be prefixed by the
252-
package name, e.g. `mtl> Building ...`. This will include the output from
253-
dependencies being built, not just targets.
254-
255-
Unset the flag to disable this behaviour. When disabled:
256-
257-
* When building a single target package (e.g., `stack build` in a project
258-
with only one package, or `stack build <package_name>` in a multi-package
259-
project), the build output from GHC will be hidden for building all
260-
dependencies, and will be displayed for the one target package.
261-
* By default, when building multiple target packages, the output from these
262-
will end up in a log file instead of on the console unless it contains
263-
errors or warnings, to avoid problems of interleaved output and decrease
264-
console noise. If you would like to see this content instead, you can use
265-
the `dump-logs` option.
250+
Set the flag for interleaved output. With interleaved output, each line of
251+
output from each package being built (targets and dependencies) is sent to the
252+
console as it happens and output relating to different packages can be
253+
interleaved. Each line will be prefixed with the name of the relevant package.
254+
The spacing between the prefix and the output will be set based on the longest
255+
relevant package name, so that the start of the output itself aligns. For
256+
example (extract):
257+
258+
~~~text
259+
hpack > build
260+
mustache > configure
261+
hpack > Preprocessing library for hpack-0.35.0..
262+
hpack > Building library for hpack-0.35.0..
263+
mustache > Configuring mustache-2.4.1...
264+
hpack > [ 1 of 29] Compiling Data.Aeson.Config.Key
265+
hpack > [ 2 of 29] Compiling Data.Aeson.Config.KeyMap
266+
mustache > build
267+
hpack > [ 3 of 29] Compiling Data.Aeson.Config.Util
268+
mustache > Preprocessing library for mustache-2.4.1..
269+
mustache > Building library for mustache-2.4.1..
270+
hpack > [ 4 of 29] Compiling Hpack.Haskell
271+
hpack > [ 5 of 29] Compiling Hpack.Utf8
272+
mustache > [1 of 8] Compiling Paths_mustache
273+
hpack > [ 6 of 29] Compiling Imports
274+
hpack > [ 7 of 29] Compiling Hpack.Util
275+
mustache > [2 of 8] Compiling Text.Mustache.Internal
276+
~~~
277+
278+
Unset the flag for non-interleaved output. With non-interleaved output, the
279+
build output from GHC (as opposed to from Stack) in respect of dependencies is
280+
ignored. The behaviour then depends whether there is one target package or more
281+
than one. There can be one target if the project has a single package or if one
282+
package is targetted in a multi-package project (for example, using
283+
`stack build <package_name>`).
284+
285+
* **One target package:** The build output for the target package is sent to the
286+
console as it happens.
287+
288+
* **More than one target package:** The build output from GHC (as opposed to
289+
from Stack) for each target package is sent to a log file for that package,
290+
unless an error occurs. At the end of the build, the location of the directory
291+
containing the log files is reported. To also output the contents of the log
292+
files to the console at the end of the build, use Stack's `dump-logs` option.
293+
For further information about that option, see the
294+
[YAML configuration](yaml_configuration.md#dump-logs) documentation. The
295+
default `dump-logs` mode is to output the contents of the log files that are
296+
warnings.
266297

267298
### The `stack build --pedantic` flag
268299

doc/maintainers/7zip.md

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
<div class="hidden-warning"><a href="https://docs.haskellstack.org/"><img src="https://cdn.jsdelivr.net/gh/commercialhaskell/stack/doc/img/hidden-warning.svg"></a></div>
2+
3+
# Upgrading 7-Zip
4+
5+
When installing GHC or MSYS2 on Windows, Stack will also install
6+
[7-Zip](https://www.7-zip.org/). 7-Zip is a file archiver and is used by Stack
7+
to extract files from archives. This section explains the steps required to
8+
upgrade the 7-Zip version used by Stack. The 7-Zip functionality used by Stack
9+
is mature and stable. It is anticipated that the Stack-supplied 7-Zip will not
10+
need to be updated frequently. On 10 September 2022, it was updated from 7-Zip
11+
9.20 (released on 18 November 2010) to 7-Zip 22.01 (released on 15 July 2022).
12+
13+
1. Download the latest installer for 64-bit x64 Windows from 7-Zip's website.
14+
15+
2. Run the installer and install to the default location
16+
(`C:\C:\Program Files\7-Zip`). The four relevant files from those installed
17+
will be:
18+
19+
~~~text
20+
7z.exe # 7-Zip Console
21+
7z.dll # 7-Zip Engine
22+
license.txt # 7-Zip License
23+
readme.txt # 7-Zip Overview
24+
~~~
25+
26+
3. In the
27+
[commercialhaskell/stackage-content](https://github.com/commercialhaskell/stackage-content)
28+
GitHub repository, create a new draft release tagged and named `7z-XX.YY`,
29+
where `XX.YY` is the 7-Zip version number.
30+
31+
4. Upload the four relevant files in step 2 above into the draft release.
32+
33+
5. Provide a description for the release. For example:
34+
35+
~~~text
36+
7-Zip 22.01 (2022-07-15) for Windows 64-bit x64.
37+
~~~
38+
39+
6. Publish the release.
40+
41+
7. Changes need to be made to the
42+
[stackage-content/stack/stack-setup-2.yaml](https://github.com/commercialhaskell/stackage-content/blob/master/stack/stack-setup-2.yaml)
43+
file, to switch over to using the newly uploaded files. For example
44+
(extract):
45+
46+
~~~yaml
47+
sevenzexe-info:
48+
url: "https://github.com/commercialhaskell/stackage-content/releases/download/7z-22.01/7z.exe"
49+
content-length: 545280
50+
sha256: 254cf6411d38903b2440819f7e0a847f0cfee7f8096cfad9e90fea62f42b0c23
51+
52+
sevenzdll-info:
53+
url: "https://github.com/commercialhaskell/stackage-content/releases/download/7z-22.01/7z.dll"
54+
content-length: 1814016
55+
sha256: 73578f14d50f747efa82527a503f1ad542f9db170e2901eddb54d6bce93fc00e
56+
~~~
57+
58+
The `content-length:` key's value is the size of the file in bytes. It can
59+
be obtained from the `Length` field of the `dir` command. The `sha256:`
60+
key's value can be obtained from the commands (in PowerShell):
61+
62+
~~~text
63+
(Get-FileHash 7z.exe -Algorithm SHA256).Hash.ToLower()
64+
(Get-FileHash 7z.dll -Algorithm SHA256).Hash.ToLower()
65+
~~~
66+
67+
The `sha256:` key only accepts lowercase hash results as values.
68+
69+
8. The changed `stack-setup-2.yaml` file should be tested locally. This can be
70+
done by:
71+
72+
* temporarily disabling the existing local copy of 7-Zip by changing the
73+
name of the `7z.exe` and `7z.dll` files in the `stack path --programs`
74+
directory;
75+
76+
* identifying a version of GHC not already installed in the
77+
`stack path --programs` directory; and
78+
79+
* executing the command:
80+
81+
~~~text
82+
stack --resolver <snapshot> setup --setup-info-yaml <path to local copy of stack-setup-2.yaml>
83+
~~~
84+
85+
where `<snapshot>` requires the missing version of GHC.
86+
87+
If all is well, the command should proceed to download the missing version
88+
of GHC, download the `7z.exe` and `7z.dll` files, and use the 7-Zip version
89+
to extract files from the GHC archive.
90+
91+
9. Raise a pull request on `commercialhaskell/stackage-contents` for the
92+
changes to the locally-tested `stack-setup-2.yaml` file.

doc/yaml_configuration.md

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -620,17 +620,24 @@ Default: `warning`
620620

621621
Command line equivalent (takes precedence): `--[no-]dump-logs` flag
622622

623-
Control which log output from local non-dependency packages to print to the
624-
console. By default, Stack will only do this when building a single target
625-
package or if the log contains warnings, to avoid generating unnecessarily
626-
verbose output.
623+
In the case of *non-interleaved* output and *more than one* target package,
624+
Stack sends the build output from GHC for each target package to a log file,
625+
unless an error occurs. For further information, see the
626+
[`stack build --[no-]interleaved-output` flag](build_command.md#the-stack-build---no-interleaved-output-flag)
627+
documentation.
628+
629+
The value of the `dump-logs` key controls what, if any, log file content is sent
630+
('dumped') to the console at the end of the build. Possible values are:
627631

628632
~~~yaml
629-
dump-logs: none # don't dump logs even if they contain warnings
630-
dump-logs: warning # dump logs that contain warnings
631-
dump-logs: all # dump all logs for local non-dependency packages
633+
dump-logs: none # don't dump the content of any log files
634+
dump-logs: warning # dump the content of log files that are warnings
635+
dump-logs: all # dump all of the content of log files
632636
~~~
633637

638+
At the command line, `--no-dump-logs` is equivalent to `dump-logs: none` and
639+
`--dump-logs` is equivalent to `dump-logs: all`.
640+
634641
### extra-include-dirs
635642

636643
Default: `[]`

mkdocs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ nav:
5757
- Add GHC version: maintainers/ghc.md
5858
- Docker images: maintainers/docker.md
5959
- Upgrading MSYS2: maintainers/msys.md
60+
- Upgrading 7-Zip: maintainers/7zip.md
6061
- HaskellStack.org: maintainers/haskellstack.org.md
6162
- Signing key: SIGNING_KEY.md
6263
- Glossary: glossary.md

0 commit comments

Comments
 (0)