Skip to content

Commit

Permalink
Improve docs of helloworld files
Browse files Browse the repository at this point in the history
  • Loading branch information
mpilgrem committed Aug 18, 2024
1 parent 27bfc05 commit ea4e900
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 21 deletions.
1 change: 1 addition & 0 deletions doc/glossary.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ The following terms are used in Stack's documentation.
|Linux |A family of operating systems based on the Linux kernel. |
|macOS |The primary operating system for Apple's Mac computers. Previously known as Mac OS X or OS X.|
|Make |A [build automation tool](https://www.gnu.org/software/make/).|
|Markdown |A plain text [formatting syntax](https://daringfireball.net/projects/markdown/) or software used to convert files in that format to HTML.|
|MSYS2 |The [MSYS2](https://www.msys2.org/) software distribution and building platform for Windows.|
|Nix |A purely functional [package manager](https://nixos.org/), available for Linux and macOS.|
|package |A Haskell package is an organised collection of Haskell code and related files. It is described by a Cabal file or a `package.yaml` file, which is itself part of the package.|
Expand Down
80 changes: 59 additions & 21 deletions doc/tutorial/hello_world_example.md
Original file line number Diff line number Diff line change
Expand Up @@ -337,31 +337,69 @@ Having build the test suite executable, Stack then automatically runs it.
Let's look at the `helloworld` example in more detail to understand better how
Stack works.

The files in the project include:

~~~text
app/Main.hs
src/Lib.hs
test/Spec.hs
ChangeLog.md
README.md
LICENSE
.gitignore
package.yaml
helloworld.cabal
Setup.hs
stack.yaml
The files in the project are set out below. Click :material-plus-circle: to
learn more about each file:

~~~shell
.
├── app
│   └── Main.hs # (1)!
├── src
│   └── Lib.hs # (2)!
├── test
│ └── Spec.hs # (3)!
├── .gitignore # (4)!
├── CHANGELOG.md # (5)!
├── LICENSE # (6)!
├── README.md # (7)!
├── package.yaml # (8)!
├── helloworld.cabal # (9)!
├── Setup.hs # (10)!
└── stack.yaml # (11)!
~~~

The `app/Main.hs`, `src/Lib.hs`, and `test/Spec.hs` files are all Haskell
source files that compose the actual functionality of our project. We won't
dwell on them here.
1. The Haskell source code for the executable (application).

As your project develops you can add further source code files to the `app`
directory.

2. The executable uses a library. The Haskell source code for the library.

As your project develops you can add further source code files to the `src`
directory.

3. The package has a test suite executable. The Haskell source code for the
test suite.

As your project develops you can add further source code files to the `test`
directory.

4. A text file used to configure the Git tool to ignore certain files. Does not
affect the build.

5. A text file in the Markdown format in which changes to the project can be
documented. Does not affect the build.

6. A text file used to document the copyright applicable to the project's files
and the licence for the use of those files. Does not affect the build.

7. A text file in the Markdown format which is intended to be read by users of
the project. Does not affect the build.

8. A file describing the package in the Hpack format. See further below.

9. A file describing the package in the Cabal format. See further below.

10. A Haskell source file which is a component of the Cabal build system. See
further below.

The `ChangeLog.md`, `README.md`, `LICENSE` and `.gitignore` files have no effect
on the build.
11. A text file in the YAML format, containing Stack's project-level
configuration. See further below.

The files of interest here are `package.yaml`, `helloworld.cabal`, `Setup.hs`
and `stack.yaml`.
The files of most interest here are `package.yaml`, `helloworld.cabal`,
`Setup.hs` and `stack.yaml`.

### `package.yaml`

Expand Down

0 comments on commit ea4e900

Please sign in to comment.