Skip to content

Commit f59e0c1

Browse files
committed
Merge branch 'stable'
2 parents e80e72d + 05147a6 commit f59e0c1

File tree

7 files changed

+104
-105
lines changed

7 files changed

+104
-105
lines changed

doc/GUIDE.md

Lines changed: 46 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ Stack is a modern, cross-platform build tool for Haskell code.
66

77
This guide takes a new Stack user through the typical workflows. This guide will
88
not teach Haskell or involve much code, and it requires no prior experience with
9-
the Haskell packaging system or other build tools.
9+
the Haskell packaging system or other build tools. Terms used in the guide are
10+
defined in the [glossary](glossary.md).
1011

1112
__NOTE__ This document is probably out of date in some places and deserves a
1213
refresh. If you find this document helpful, please drop a note on
@@ -651,21 +652,16 @@ _Duplicate package names_: If multiple packages under the directory tree have
651652
same name, `stack init` will report those and automatically ignore one of them.
652653

653654
_Ignore subdirectories_: By default `stack init` searches all the subdirectories
654-
for `.cabal` files. If you do not want that then you can use `--ignore-subdirs`
655+
for Cabal files. If you do not want that then you can use `--ignore-subdirs`
655656
command line switch.
656657

657658
_Cabal warnings_: `stack init` will show warnings if there were issues in
658-
reading a Cabal package file. You may want to pay attention to the warnings as
659-
sometimes they may result in incomprehensible errors later on during dependency
660-
solving.
659+
reading a Cabal file. You may want to pay attention to the warnings as sometimes
660+
they may result in incomprehensible errors later on during dependency solving.
661661

662662
_Package naming_: If the `Name` field defined in a Cabal file does not match
663663
with the Cabal file name then `stack init` will refuse to continue.
664664

665-
_Cabal install errors_: `stack init` uses `cabal-install` to determine external
666-
dependencies. When `cabal-install` encounters errors, Cabal errors are displayed
667-
as is by `stack init` for diagnostics.
668-
669665
_User warnings_: When packages are excluded or external dependencies added
670666
Stack will show warnings every time configuration file is loaded. You can
671667
suppress the warnings by editing the config file and removing the warnings from
@@ -808,9 +804,9 @@ This will:
808804

809805
### install and copy-bins
810806

811-
It's worth calling out the behavior of the install command and `--copy-bins`
807+
It's worth calling out the behavior of the `install` command and `--copy-bins`
812808
option, since this has confused a number of users (especially when compared to
813-
behavior of other tools like cabal-install). The `install` command does
809+
behavior of other tools like Cabal (the tool)). The `install` command does
814810
precisely one thing in addition to the build command: it copies any generated
815811
executables to the local bin path. You may recognize the default value for that
816812
path:
@@ -820,13 +816,13 @@ michael@d30748af6d3d:~/helloworld$ stack path --local-bin
820816
/home/michael/.local/bin
821817
```
822818

823-
That's why the download page recommends adding that directory to your `PATH`
824-
environment variable. This feature is convenient, because now you can simply
825-
run `executable-name` in your shell instead of having to run
826-
`stack exec executable-name` from inside your project directory.
819+
That's why the download page recommends adding that directory to your PATH. This
820+
feature is convenient, because now you can simply run `executable-name` in your
821+
shell instead of having to run `stack exec executable-name` from inside your
822+
project directory.
827823

828824
Since it's such a point of confusion, let me list a number of things Stack does
829-
*not* do specially for the install command:
825+
*not* do specially for the `install` command:
830826

831827
* Stack will always build any necessary dependencies for your code. The install
832828
command is not necessary to trigger this behavior. If you just want to build a
@@ -1175,12 +1171,12 @@ Flags worth mentioning:
11751171
* `--package foo` can be used to force a package to be installed before running
11761172
the given command.
11771173
* `--no-ghc-package-path` can be used to stop the `GHC_PACKAGE_PATH` environment
1178-
variable from being set. Some tools — notably cabal-install — do not behave
1174+
variable from being set. Some tools — notably Cabal (the tool) — do not behave
11791175
well with that variable set.
11801176
11811177
You may also find it convenient to use `stack exec` to launch a subshell
11821178
(substitute `bash` with your preferred shell) where your compiled executable is
1183-
available at the front of your `PATH`:
1179+
available at the front of your PATH:
11841180
11851181
stack exec bash
11861182
@@ -1391,7 +1387,7 @@ that project. See the next section for more information on configuration files.
13911387
13921388
### Platform-specific script issues
13931389
1394-
On Mac OSX:
1390+
On macOS:
13951391
13961392
- Avoid `{-# LANGUAGE CPP #-}` in Stack scripts; it breaks the hashbang line
13971393
([GHC #6132](https://gitlab.haskell.org/ghc/ghc/issues/6132))
@@ -1494,38 +1490,39 @@ not convincing a tool to do what you want.
14941490
14951491
Before jumping into the differences, let me clarify an important similarity:
14961492
1497-
__Same package format.__ Stack, cabal-install, and presumably all other tools
1498-
share the same underlying Cabal package format, consisting of a `.cabal` file,
1493+
__Same package format.__ Stack, Cabal (the tool), and presumably all other tools
1494+
share the same underlying Cabal package format, consisting of a Cabal file,
14991495
modules, etc. This is a Good Thing: we can share the same set of upstream
1500-
libraries, and collaboratively work on the same project with Stack,
1501-
cabal-install, and NixOS. In that sense, we're sharing the same ecosystem.
1496+
libraries, and collaboratively work on the same project with Stack, Cabal (the
1497+
tool), and NixOS. In that sense, we're sharing the same ecosystem.
15021498
15031499
Now the differences:
15041500
15051501
* __Curation vs dependency solving as a default__.
15061502
* Stack defaults to using curation (Stackage snapshots, LTS Haskell,
15071503
Nightly, etc) as a default instead of defaulting to dependency solving, as
1508-
cabal-install does. This is just a default: as described above, Stack can
1509-
use dependency solving if desired, and cabal-install can use curation.
1510-
However, most users will stick to the defaults. The Stack team firmly
1511-
believes that the majority of users want to simply ignore dependency
1512-
resolution nightmares and get a valid build plan from day 1, which is why
1513-
we've made this selection of default behavior.
1504+
Cabal (the tool) does. This is just a default: as described above, Stack
1505+
can use dependency solving if desired, and Cabal (the tool) can use
1506+
curation. However, most users will stick to the defaults. The Stack team
1507+
firmly believes that the majority of users want to simply ignore
1508+
dependency resolution nightmares and get a valid build plan from day one,
1509+
which is why we've made this selection of default behavior.
15141510
* __Reproducible__.
15151511
* Stack goes to great lengths to ensure that `stack build` today does the
1516-
same thing tomorrow. cabal-install does not: build plans can be affected
1517-
by the presence of preinstalled packages, and running `cabal update` can
1518-
cause a previously successful build to fail. With Stack, changing the
1519-
build plan is always an explicit decision.
1512+
same thing tomorrow. Cabal (the tool) does not: build plans can be
1513+
affected by the presence of pre-installed packages, and running
1514+
`cabal update` can cause a previously successful build to fail. With
1515+
Stack, changing the build plan is always an explicit decision.
15201516
* __Automatically building dependencies__.
1521-
* In cabal-install, you need to use `cabal install` to trigger dependency
1522-
building. This is somewhat necessary due to the previous point, since
1523-
building dependencies can, in some cases, break existing installed
1517+
* With Cabal (the tool), you need to use `cabal install` to trigger
1518+
dependency building. This is somewhat necessary due to the previous point,
1519+
since building dependencies can, in some cases, break existing installed
15241520
packages. So for example, in Stack, `stack test` does the same job as
15251521
`cabal install --run-tests`, though the latter *additionally* performs an
1526-
installation that you may not want. The closer command equivalent is
1527-
`cabal install --enable-tests --only-dependencies && cabal configure --enable-tests && cabal build && cabal test`
1528-
(newer versions of cabal-install may make this command shorter).
1522+
installation that you may not want. The closer equivalent command sequence
1523+
is: `cabal install --enable-tests --only-dependencies`,
1524+
`cabal configure --enable-tests`, `cabal build && cabal test` (newer
1525+
versions of Cabal (the tool) may make this command sequence shorter).
15291526
* __Isolated by default__.
15301527
* This has been a pain point for new Stack users. In Cabal, the default
15311528
behavior is a non-isolated build where working on two projects can
@@ -1536,22 +1533,22 @@ Now the differences:
15361533
15371534
__Other tools for comparison (including active and historical)__
15381535
1539-
* [cabal-dev](https://hackage.haskell.org/package/cabal-dev) (deprecated in
1540-
favor of cabal-install)
1536+
* [cabal-dev](https://hackage.haskell.org/package/cabal-dev). This is deprecated
1537+
in favor of Cabal (the tool).
15411538
* [cabal-meta](https://hackage.haskell.org/package/cabal-meta) inspired a lot of
1542-
the multi-package functionality of stack. If you're still using cabal-install,
1543-
cabal-meta is relevant. For Stack work, the feature set is fully subsumed by
1544-
Stack.
1539+
the multi-package functionality of Stack. If you're still using Cabal (the
1540+
tool), `cabal-meta` is relevant. For Stack work, the feature set is fully
1541+
subsumed by Stack.
15451542
* [cabal-src](https://hackage.haskell.org/package/cabal-src) is mostly
15461543
irrelevant in the presence of both Stack and Cabal sandboxes, both of which
15471544
make it easier to add additional package sources easily. The mega-sdist
15481545
executable that ships with cabal-src is, however, still relevant. Its
15491546
functionality may some day be folded into Stack
15501547
* [stackage-cli](https://hackage.haskell.org/package/stackage-cli) was an
1551-
initial attempt to make cabal-install work more easily with curated snapshots,
1552-
but due to a slight impedance mismatch between cabal.config constraints and
1553-
snapshots, it did not work as well as hoped. It is deprecated in favor of
1554-
Stack.
1548+
initial attempt to make Cabal (the tool) work more easily with curated
1549+
snapshots, but due to a slight impedance mismatch between cabal.config
1550+
constraints and snapshots, it did not work as well as hoped. It is deprecated
1551+
in favor of Stack.
15551552
15561553
## Fun features
15571554
@@ -1697,7 +1694,7 @@ the Nixpkgs.
16971694
Both Docker and Nix are methods to *isolate* builds and thereby make them more
16981695
reproducible. They just differ in the means of achieving this isolation. Nix
16991696
provides slightly weaker isolation guarantees than Docker, but is more
1700-
lightweight and more portable (Linux and OS X mainly, but also Windows). For
1697+
lightweight and more portable (Linux and macOS mainly, but also Windows). For
17011698
more on Nix, its command-line interface and its package description language,
17021699
read the [Nix manual](http://nixos.org/nix/manual). But keep in mind that the
17031700
point of Stack's support is to obviate the need to write any Nix code in the

doc/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,8 @@ Stack. If you want to go further, we highly recommend you read the
154154
## Complete guide to Stack
155155

156156
A complete [user guide to Stack](GUIDE.md) is available, covering all of
157-
the most common ways to use Stack.
157+
the most common ways to use Stack. Terms used in Stack's documentation are also
158+
explained in the [glossary](glossary.md).
158159

159160
## Why Stack?
160161

doc/docker_integration.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ otherwise noted.
199199
# What to name the Docker container. Only useful with `detach` or
200200
# `persist` true. (default none)
201201
container-name: "example-name"
202-
202+
203203
# Sets the network used by docker. Gets directly passed to dockers `net`
204204
# argument (default: host)
205205
network: host
@@ -263,8 +263,8 @@ Image Repositories
263263
FP Complete provides the following public image repositories on Docker Hub:
264264

265265
- [fpco/stack-build](https://registry.hub.docker.com/u/fpco/stack-build/) (the
266-
default) - GHC (patched), tools (stack, cabal-install, happy, alex, etc.), and
267-
system developer libraries required to build all Stackage packages.
266+
default) - GHC (patched), tools (Stack, Cabal (the tool), happy, alex, etc.),
267+
and system developer libraries required to build all Stackage packages.
268268

269269
FP Complete also builds custom variants of these images for their clients.
270270

doc/faq.md

Lines changed: 40 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -42,31 +42,32 @@ installs the Stackage libraries in `~/.stack` and any project libraries or
4242
extra dependencies in a `.stack-work` directory within each project's
4343
directory. None of this should affect any existing Haskell tools at all.
4444

45-
## What is the relationship between stack and cabal?
46-
47-
* 'Cabal' can refer to the `Cabal` library or to the `cabal` command-line tool
48-
(provided by the `cabal-install` package). Cabal-the-library is used by stack
49-
to build your Haskell code.
50-
* A `.cabal` file is provided for each package. It defines all package-level
51-
metadata, just like it does in the `cabal-install` world: modules,
52-
executables, test suites, etc. No change at all on this front.
45+
## What is the relationship between Stack and Cabal (the tool)?
46+
47+
* 'Cabal' can refer to Cabal (the library) or to Cabal (the tool). Cabal (the
48+
library) is used by Stack to build your Haskell code. Cabal (the tool) is
49+
provided by the `cabal-install` package.
50+
* A Cabal file is provided for each package, named `<package_name>.cabal`. It
51+
defines all package-level metadata, just like it does in the world of Cabal
52+
(the tool): modules, executables, test suites, etc. No change at all on this
53+
front.
5354
* A `stack.yaml` file references one or more packages, and provides information
5455
on where dependencies come from.
5556
* The `stack init` command initializes a `stack.yaml` file from an existing
56-
`.cabal` file.
57-
* Stack uses `Cabal` via an executable. For `build-type: Simple` (the most
58-
common case), stack builds that executable using the version of `Cabal` which
59-
came with the compiler. Stack caches such executables, in the stack root under
60-
folder `setup-exe-cache`.
61-
* In rare or complex cases, a different version of `Cabal` to the one that came
57+
Cabal file.
58+
* Stack uses Cabal (the library) via an executable. For `build-type: Simple`
59+
(the most common case), Stack builds that executable using the version of
60+
Cabal which came with the compiler. Stack caches such executables, in the
61+
Stack root under directory `setup-exe-cache`.
62+
* In rare or complex cases, a different version of Cabal to the one that came
6263
with the compiler may be needed. `build-type: Custom` and a `setup-custom`
63-
stanza in the `.cabal` file, and a `Setup.hs` file in the package folder, can
64-
be specified. The `stack.yaml` file can then specify the version of `Cabal`
65-
that stack will use to build the executable (named `setup`) from `Setup.hs`.
66-
Stack will use `Cabal` via `setup`.
64+
stanza in the Cabal file, and a `Setup.hs` file in the package directory, can
65+
be specified. The `stack.yaml` file can then specify the version of Cabal
66+
that Stack will use to build the executable (named `setup`) from `Setup.hs`.
67+
Stack will use Cabal via `setup`.
6768

68-
For detail on the differences between a `stack.yaml` and Cabal package file, see
69-
[stack.yaml vs cabal package file](stack_yaml_vs_cabal_package_file.md).
69+
For detail on the differences between a `stack.yaml` file and a Cabal file, see
70+
[stack.yaml vs Cabal package file](stack_yaml_vs_cabal_package_file.md).
7071

7172
## I need to use a different version of a package than what is provided by the LTS Haskell snapshot I'm using, what should I do?
7273

@@ -140,27 +141,27 @@ installed packages with actions taken in other projects.
140141

141142
## Can I run `cabal` commands inside `stack exec`?
142143

143-
With a recent enough version of cabal-install (>= 1.22), you can. For older
144-
versions, due to
145-
[haskell/cabal#1800](https://github.com/haskell/cabal/issues/1800), this does
146-
not work. Note that even with recent versions, for some commands you may need
147-
this extra level of indirection:
148-
```
149-
$ stack exec -- cabal exec -- cabal <command>
150-
```
144+
With a recent enough version of Cabal (the tool) (1.22 or later), you can. For
145+
earlier versions this does not work, due to
146+
[haskell/cabal#1800](https://github.com/haskell/cabal/issues/1800). Note that
147+
even with recent versions, for some commands you may need this extra level of
148+
indirection:
149+
150+
$ stack exec -- cabal exec -- cabal <command>
151+
152+
However, virtually all `cabal` commands have an equivalent in Stack, so this
153+
should not be necessary. In particular, users of Cabal (the tool) may be
154+
accustomed to the `cabal run` command. In Stack:
155+
156+
$ stack build
157+
$ stack exec <program-name>
151158

152-
However, virtually all `cabal` commands have an equivalent in stack, so this
153-
should not be necessary. In particular, `cabal` users may be accustomed to the
154-
`cabal run` command. In stack:
155-
```
156-
$ stack build && stack exec <program-name>
157-
```
158159
Or, if you want to install the binaries in a shared location:
159-
```
160-
$ stack install
161-
$ <program-name>
162-
```
163-
assuming your `$PATH` has been set appropriately.
160+
161+
$ stack install
162+
$ <program-name>
163+
164+
assuming your PATH has been set appropriately.
164165

165166
## Using custom preprocessors
166167

doc/glossary.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ The following terms are used in Stack's documentation.
3030
|Nix |A purely functional [package manager](https://nixos.org/), available for Linux and macOS.|
3131
|`package.yaml` |A file that describes a package in the Hpack format. |
3232
|Pantry |A library for content-addressable Haskell package management, provided by the [`pantry` package](https://hackage.haskell.org/package/pantry). A dependency of Stack.|
33-
|REPL | An interactive (run-eval-print loop) programming environment.|
33+
|PATH |The `PATH` environment variable, specifying a list of directories searched for executable files.|
34+
|REPL |An interactive (run-eval-print loop) programming environment.|
3435
|resolver |A synonym for snapshot. |
3536
|`Setup.hs` |A project-specific file used by Cabal to perform setup tasks.|
3637
|snapshot |A snapshot defines a GHC version, a set of packages, and build flags or other settings.|

doc/maintainers/releases.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,7 @@ Now continue to the **General Windows setup** subsection below.
439439
Binary: get an [existing `stack` binary](https://github.com/commercialhaskell/stack/releases)
440440
and put it in `~/.local/bin`.
441441
442-
From source (using cabal-install):
442+
From source, using Cabal (the tool):
443443
444444
```
445445
wget http://downloads.haskell.org/~ghc/7.10.3/ghc-7.10.3-armv7-deb8-linux.tar.xz && \

doc/nonstandard_project_init.md

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,17 @@
44

55
## Introduction
66
The purpose of this page is to collect information about issues that arise when
7-
users either have an existing cabal project or another nonstandard setup such
8-
as a private hackage database.
7+
users either have an existing Cabal project or another nonstandard setup such
8+
as a private Hackage database.
99

10-
## Using a Cabal File
10+
## Using a Cabal file
1111

12-
New users may be confused by the fact that you must add
13-
dependencies to the package's cabal file, even in the case when you have
14-
already listed the package in the `stack.yaml`. In most cases, dependencies for
15-
your package that are in the Stackage snapshot need *only* be added to the
16-
cabal file. stack makes heavy use of Cabal the library under the hood. In
17-
general, your stack packages should also end up being valid cabal-install
18-
packages.
12+
New users may be confused by the fact that you must add dependencies to the
13+
package's Cabal file, even in the case when you have already listed the package
14+
in the `stack.yaml` file. In most cases, dependencies for your package that are
15+
in the Stackage snapshot need *only* be added to the Cabal file. Stack makes
16+
heavy use of Cabal under the hood. In general, your Stack packages should also
17+
end up being valid packages for Cabal (the tool).
1918

2019
### Issues Referenced
2120
- <https://github.com/commercialhaskell/stack/issues/105>
@@ -44,7 +43,7 @@ It is also possible to pass the same flag to multiple packages, i.e.
4443
`stack build --flag *:necessary`
4544

4645
Currently one needs to list all of your modules that interpret flags in the
47-
`other-modules` section of a cabal file. `cabal-install` has a different
46+
`other-modules` section of a cabal file. Cabal (the tool) has a different
4847
behavior currently and doesn't require that the modules be listed. This may
4948
change in a future release.
5049

0 commit comments

Comments
 (0)