@@ -6,7 +6,8 @@ Stack is a modern, cross-platform build tool for Haskell code.
6
6
7
7
This guide takes a new Stack user through the typical workflows. This guide will
8
8
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 ) .
10
11
11
12
__ NOTE__ This document is probably out of date in some places and deserves a
12
13
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
651
652
same name, `stack init` will report those and automatically ignore one of them.
652
653
653
654
_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`
655
656
command line switch.
656
657
657
658
_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.
661
661
662
662
_Package naming_ : If the `Name` field defined in a Cabal file does not match
663
663
with the Cabal file name then `stack init` will refuse to continue.
664
664
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
-
669
665
_User warnings_ : When packages are excluded or external dependencies added
670
666
Stack will show warnings every time configuration file is loaded. You can
671
667
suppress the warnings by editing the config file and removing the warnings from
@@ -808,9 +804,9 @@ This will:
808
804
809
805
# ## install and copy-bins
810
806
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`
812
808
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
814
810
precisely one thing in addition to the build command : it copies any generated
815
811
executables to the local bin path. You may recognize the default value for that
816
812
path :
@@ -820,13 +816,13 @@ michael@d30748af6d3d:~/helloworld$ stack path --local-bin
820
816
/home/michael/.local/bin
821
817
` ` `
822
818
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.
827
823
828
824
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:
830
826
831
827
* Stack will always build any necessary dependencies for your code. The install
832
828
command is not necessary to trigger this behavior. If you just want to build a
@@ -1175,12 +1171,12 @@ Flags worth mentioning:
1175
1171
* `--package foo` can be used to force a package to be installed before running
1176
1172
the given command.
1177
1173
* `--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
1179
1175
well with that variable set.
1180
1176
1181
1177
You may also find it convenient to use `stack exec` to launch a subshell
1182
1178
(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:
1184
1180
1185
1181
stack exec bash
1186
1182
@@ -1391,7 +1387,7 @@ that project. See the next section for more information on configuration files.
1391
1387
1392
1388
### Platform-specific script issues
1393
1389
1394
- On Mac OSX :
1390
+ On macOS :
1395
1391
1396
1392
- Avoid `{-# LANGUAGE CPP #-}` in Stack scripts; it breaks the hashbang line
1397
1393
([GHC #6132](https://gitlab.haskell.org/ghc/ghc/issues/6132))
@@ -1494,38 +1490,39 @@ not convincing a tool to do what you want.
1494
1490
1495
1491
Before jumping into the differences, let me clarify an important similarity:
1496
1492
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,
1499
1495
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.
1502
1498
1503
1499
Now the differences:
1504
1500
1505
1501
* __Curation vs dependency solving as a default__.
1506
1502
* Stack defaults to using curation (Stackage snapshots, LTS Haskell,
1507
1503
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.
1514
1510
* __Reproducible__.
1515
1511
* 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.
1520
1516
* __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
1524
1520
packages. So for example, in Stack, `stack test` does the same job as
1525
1521
`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).
1529
1526
* __Isolated by default__.
1530
1527
* This has been a pain point for new Stack users. In Cabal, the default
1531
1528
behavior is a non-isolated build where working on two projects can
@@ -1536,22 +1533,22 @@ Now the differences:
1536
1533
1537
1534
__Other tools for comparison (including active and historical)__
1538
1535
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).
1541
1538
* [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.
1545
1542
* [cabal-src](https://hackage.haskell.org/package/cabal-src) is mostly
1546
1543
irrelevant in the presence of both Stack and Cabal sandboxes, both of which
1547
1544
make it easier to add additional package sources easily. The mega-sdist
1548
1545
executable that ships with cabal-src is, however, still relevant. Its
1549
1546
functionality may some day be folded into Stack
1550
1547
* [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.
1555
1552
1556
1553
## Fun features
1557
1554
@@ -1697,7 +1694,7 @@ the Nixpkgs.
1697
1694
Both Docker and Nix are methods to *isolate* builds and thereby make them more
1698
1695
reproducible. They just differ in the means of achieving this isolation. Nix
1699
1696
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
1701
1698
more on Nix, its command-line interface and its package description language,
1702
1699
read the [Nix manual](http://nixos.org/nix/manual). But keep in mind that the
1703
1700
point of Stack's support is to obviate the need to write any Nix code in the
0 commit comments