Skip to content

Commit 2cbc66b

Browse files
committed
Fix #5498 Clarify that package.yaml is an Hpack file format
1 parent 4390b95 commit 2cbc66b

File tree

4 files changed

+25
-19
lines changed

4 files changed

+25
-19
lines changed

doc/GUIDE.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -217,11 +217,11 @@ multi-package projects, which we'll elaborate on as this guide progresses.
217217

218218
Another file important to the build is `package.yaml`.
219219

220-
The `package.yaml` file is the preferred package format that is provided
221-
built-in by Stack through the [hpack tool](https://github.com/sol/hpack). The
222-
default behaviour is to generate the Cabal file (here named `helloworld.cabal`)
223-
from this `package.yaml` file, and accordingly you should **not** modify the
224-
Cabal file.
220+
The `package.yaml` file describes the package in the
221+
[Hpack](https://github.com/sol/hpack) format. Stack has in-built Hpack
222+
functionality and this is its preferred package format. The default behaviour is
223+
to generate the Cabal file (here named `helloworld.cabal`) from this
224+
`package.yaml` file, and accordingly you should **not** modify the Cabal file.
225225

226226
It is also important to remember that Stack is built on top of the Cabal build
227227
system. Therefore, an understanding of the moving parts in Cabal are necessary.
@@ -233,7 +233,7 @@ language pragmas, and so on.
233233

234234
In this guide, we'll discuss the bare minimum necessary to understand how to
235235
modify a `package.yaml` file. You can see a full list of the available options
236-
at the [hpack documentation](https://github.com/sol/hpack#quick-reference). The
236+
at the [Hpack documentation](https://github.com/sol/hpack#quick-reference). The
237237
Cabal User Guide the definitive reference for the
238238
[Cabal file format](https://cabal.readthedocs.io/en/stable/cabal-package.html).
239239

doc/faq.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -556,9 +556,15 @@ Unfortunately `stack build` does not have an obvious equivalent to `cabal build
556556
557557
Yes:
558558
559-
* If a package directory contains an Hpack `package.yaml` file, then Stack will use it to generate a `.cabal` file when building the package.
560-
* You can run `stack init` to initialize a `stack.yaml` file regardless of whether your packages are declared with `.cabal` files or with Hpack `package.yaml` files.
561-
* You can use the `with-hpack` configuration option to specify an Hpack executable to use instead of the Hpack bundled with Stack.
559+
* If a package directory contains an [Hpack](https://github.com/sol/hpack)
560+
`package.yaml` file, then Stack will use it to generate a Cabal file when
561+
building the package.
562+
* You can run `stack init` to initialize a `stack.yaml` file regardless of
563+
whether your packages are declared with Cabal files or with Hpack
564+
`package.yaml` files.
565+
* You can use the `with-hpack` YAML configuration or command line option to
566+
specify an Hpack executable to use instead of Stack's in-built Hpack
567+
functionality.
562568
563569
## How do I resolve linker errors when running `stack setup` or `stack build` on macOS?
564570

doc/stack_yaml_vs_cabal_package_file.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
<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>
22

3-
# stack.yaml vs cabal package file
3+
# stack.yaml vs Cabal package file
44

55
Due to their apparent overlap, the purpose of the following three files can be
66
unclear:
77

88
* `stack.yaml`
9-
* A cabal package file, e.g. `my-package.cabal`
9+
* A Cabal package file, e.g. `my-package.cabal`
1010
* `package.yaml`
1111

1212
The last two are easy to explain: `package.yaml` is a file format supported by
13-
[hpack](https://github.com/sol/hpack#readme). It adds some niceties on top of
14-
cabal. For example, hpack has YAML syntax support and will automatically
15-
generate of `exposed-modules` lists. However, it's just a frontend to cabal
13+
[Hpack](https://github.com/sol/hpack#readme). It adds some niceties on top of
14+
Cabal. For example, Hpack has YAML syntax support and will automatically
15+
generate of `exposed-modules` lists. However, it's just a frontend to Cabal
1616
package files. So for this document, we're instead going to focus on the first
1717
two and try to answer:
1818

@@ -26,12 +26,12 @@ _package_. A package has:
2626
* A name and version
2727
* 0 or 1 libraries
2828
* 0 or more executables
29-
* A cabal file (or, as mentioned above, an hpack `package.yaml` that
30-
generates a cabal file)
29+
* A Cabal file (or, as mentioned above, an [Hpack](https://github.com/sol/hpack)
30+
`package.yaml` file that generates a Cabal file)
3131
* And a bunch more
3232

3333
The second to last bullet bears repeating: there's a 1-to-1 correspondence between
34-
packages and cabal files.
34+
packages and cabal files.
3535

3636
Stack is a build tool that works on top of the Cabal build system, and defines
3737
a new concept called a _project_. A project has:

doc/yaml_configuration.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1344,8 +1344,8 @@ with-gcc: /usr/local/bin/gcc-5
13441344

13451345
### with-hpack
13461346

1347-
Use an Hpack executable, rather than the version the Hpack library built into
1348-
Stack.
1347+
Use an [Hpack](https://github.com/sol/hpack) executable, rather than Stack's
1348+
in-built version of the Hpack functionality.
13491349

13501350
```yaml
13511351
with-hpack: /usr/local/bin/hpack

0 commit comments

Comments
 (0)