Skip to content

Commit 177b415

Browse files
committed
Further simplify home page
1 parent 0417b5d commit 177b415

File tree

1 file changed

+99
-63
lines changed

1 file changed

+99
-63
lines changed

doc/README.md

Lines changed: 99 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ stack upgrade
7676
For an immediate experience of using Stack to build an executable with Haskell,
7777
first you need to follow the [guide to install Stack](#how-to-install-Stack).
7878

79-
### Start your new project
79+
### Step 1: Start your new project
8080

8181
To start a new project named `my-project`, issue these four commands in a
8282
terminal:
@@ -89,13 +89,14 @@ stack exec my-project-exe
8989
~~~
9090

9191
- The `stack new my-project` command will create a new directory, named
92-
`my-project`, that contains all the files needed to start a project correctly,
92+
`my-project`. It contains all the files needed to start a project correctly,
9393
using a default template.
94-
- The `cd my-project` command will change to that directory.
94+
- The `cd my-project` command will change the current working directory to that
95+
directory.
9596
- The `stack build` command will build the template project and create an
96-
executable named `my-project-exe`. First, if necessary, Stack will download
97-
the necessary GHC compiler in an isolated location. That won't interfere with
98-
any system-level installations of GHC.
97+
executable named `my-project-exe` (on Windows, `my-project-exe.exe`). First,
98+
if necessary, Stack will download a version of GHC in an isolated location.
99+
That won't interfere with other GHC instalations on your system.
99100
- The `stack exec my-project-exe` command will run (execute) the built
100101
executable, in Stack's environment.
101102

@@ -111,23 +112,27 @@ For help on a particular Stack command, for example `stack build`, command:
111112
stack build --help
112113
~~~
113114

114-
If you want to launch a run-eval-print loop (REPL), then command:
115+
If you want to launch a run-eval-print loop (REPL) environment, then command:
115116

116117
~~~text
117-
stack ghci
118+
stack repl
118119
~~~
119120

120-
If you want to use Stack to install an executable provided by a Haskell package,
121-
then all you have to do is command:
121+
!!! info
122+
123+
`stack ghci` can be used instead of `stack repl`. GHCi is GHC's REPL tool.
124+
125+
People organise Haskell code into packages. If you want to use Stack to install
126+
an executable provided by a Haskell package, then all you have to do is command:
122127

123128
~~~text
124129
stack install <package-name>
125130
~~~
126131

127-
### Workflow
132+
### Step 2: Next steps
128133

129-
The `stack new my-project` command above should have created the following files
130-
and directories:
134+
The `stack new my-project` command in step one should have created the following
135+
files and directories (among others):
131136

132137
~~~text
133138
.
@@ -137,47 +142,43 @@ and directories:
137142
│   └── Lib.hs
138143
├── test
139144
│ └── Spec.hs
140-
├── Setup.hs
141-
├── package.yaml
142145
├── my-project.cabal
143-
├── stack.yaml
144-
├── README.md
145-
├── ChangeLog.md
146-
├── LICENSE
147-
└── .gitignore
146+
├── package.yaml
147+
└── stack.yaml
148148
~~~
149149

150-
(The `stack build` command will have created other directories and files.)
150+
The Haskell source code for the executable (application) is in file `Main.hs`.
151151

152-
The Haskell code for the executable/application is in `Main.hs`. The
153-
source code for the library that it uses is in `Lib.hs`. The contents of
154-
`my-project.cabal` describes the project. That file is generated by the contents
155-
of `package.yaml`.
152+
The executable uses a library. Its source code is in file `Lib.hs`.
156153

157-
To manage your library:
154+
The contents of `my-project.cabal` describes the project. That file is generated
155+
by the contents of `package.yaml`.
158156

159-
1. Edit source files in the `src` directory. The `app` directory should
160-
preferably contain only files related to executables.
157+
!!! info
161158

162-
2. Your developing project may need to depend on a library provided by another
163-
Haskell package.
159+
If you want, you can delete the `package.yaml` file and update the
160+
`my-project.cabal` file directly. Stack will then use that file.
164161

165-
- Add the name of that new package to the file `package.yaml`, in its
166-
`dependencies:` section.
167-
- Run `stack build` again. Stack will use `package.yaml` to create an
168-
updated `my-project.cabal` for you.
162+
You can edit the source files in the `src` directory (used for the library) or
163+
the `app` directory (used for the executable (application)).
169164

170-
3. If desired, you can delete the `package.yaml` file and update the
171-
`my-project.cabal` file directly. Stack will then use that file.
165+
As your project develops, you may need to depend on a library provided by
166+
another Haskell package. If you do, then add the name of that new package to the
167+
file `package.yaml`, in its `dependencies:` section.
172168

173-
4. If you get an error message that tells you that the Stack configuration has
174-
no specified version of your added package, follow Stack's likely
175-
recommandation to add a specific version of that package in the `stack.yaml`
176-
file, in its `extra-deps:` section.
169+
!!! info
170+
171+
When you use `stack build` again, Stack will use `package.yaml` to create an
172+
updated `my-project.cabal` for you.
173+
174+
If Stack reports that the Stack configuration has no specified version for the
175+
new package, then follow Stack's likely recommended action to add a specific
176+
version of that package your project's `stack.yaml` file, in its `extra-deps:`
177+
section.
177178

178179
That was a really fast introduction on how to start to code in Haskell using
179180
Stack. If you want to go further, we highly recommend you read Stack's
180-
[user's guide](GUIDE.md).
181+
introductory [user's guide](GUIDE.md).
181182

182183
## Complete guide to Stack
183184

@@ -187,32 +188,40 @@ explained in the [glossary](glossary.md).
187188

188189
## Why Stack?
189190

190-
Stack is a build tool for Haskell designed to answer the needs of Haskell users
191-
new and experienced alike. It has a strong focus on reproducible build plans,
192-
multi-package projects, and a consistent, easy-to-learn interface, while
193-
providing the customizability and power experienced developers need.
191+
Stack is a build tool for Haskell designed to answer the needs of Haskell users,
192+
both new and experienced. It has a strong focus on reproducible build plans,
193+
multi-package projects, and a consistent, easy-to-learn set of Stack commands.
194+
It also aims to provide the customizability and power that experienced
195+
developers need.
194196

195-
As a build tool, Stack does not stand alone. It is built on the great work
196-
provided by:
197+
Stack does not stand alone. It is built on the great work provided by:
197198

198199
* The __Glasgow Haskell Compiler__ ([GHC](https://www.haskell.org/ghc/)), the
199200
premier Haskell compiler. Stack will manage your GHC installations and
200-
automatically select the appropriate compiler version for your project.
201-
* The __Cabal build system__, a specification for defining Haskell packages,
202-
together with a [library](https://hackage.haskell.org/package/Cabal) for
201+
automatically select the appropriate version of GHC for your project.
202+
* The __Cabal build system__. Cabal is a specification for defining Haskell
203+
packages and a [library](https://hackage.haskell.org/package/Cabal) for
203204
performing builds.
205+
206+
!!! info
207+
208+
Cabal is also the name of another build tool, provided the `cabal-install`
209+
package. This guide distinguishes between then by Cabal (the library) and
210+
Cabal (the tool).
211+
204212
* The __Hackage Haskell Package Repository__, a
205-
[repository](https://hackage.haskell.org/) providing thousands of open source
206-
libraries and applications to help you get your work done.
207-
* The __Stackage package collection__, a
208-
[curated set of packages](https://www.stackage.org/) from Hackage which are
209-
regularly tested for compatibility. Stack defaults to using Stackage
210-
package sets to avoid dependency problems.
213+
[repository](https://hackage.haskell.org/) of Haskell packages providing
214+
thousands of open source libraries and applications to help you get your work
215+
done.
216+
* The __Stackage package collection__, sets of packages from Hackage that are
217+
[curated](https://www.stackage.org/). That is, they are regularly tested for
218+
compatibility. Stack defaults to using Stackage package sets to avoid
219+
problems with incompatible dependencies.
211220

212221
Stack is provided by a team of volunteers and companies under the auspices of
213222
the [Commercial Haskell](http://commercialhaskell.com/) group. The project was
214223
spearheaded by [FP Complete](https://www.fpcomplete.com/) to answer the needs of
215-
commercial Haskell users, and has since become a thriving open source project
224+
commercial Haskell users. It has since become a thriving open source project
216225
meeting the needs of Haskell users of all stripes.
217226

218227
If you'd like to get involved with Stack, check out the
@@ -236,20 +245,47 @@ The following assumes that you already have installed a version of Stack and the
236245
[Git application](https://git-scm.com/).
237246

238247
1. Clone the `stack` repository from GitHub with the command:
239-
`git clone https://github.com/commercialhaskell/stack.git`.
240-
2. Enter into the cloned `stack` directory with command `cd stack`.
248+
249+
~~~text
250+
git clone https://github.com/commercialhaskell/stack.git`
251+
~~~
252+
253+
2. Change the current working directory to the cloned `stack` directory with the
254+
command:
255+
256+
~~~text
257+
cd stack
258+
~~~
259+
241260
3. Build the `stack` executable using a pre-existing installation of Stack with
242-
command `stack build`.
261+
the command:
262+
263+
~~~text
264+
stack build
265+
~~~
266+
243267
4. Once the `stack` executable has been built, check its version with the
244-
command `stack exec -- stack --version`. Make sure the version is the latest.
268+
command:
269+
270+
~~~text
271+
stack exec -- stack --version
272+
~~~
273+
274+
Make sure the version is the latest one.
275+
245276
5. In the GitHub respository's issue tracker, look for issues tagged with
246277
[newcomer friendly](https://github.com/commercialhaskell/stack/issues?q=is%3Aopen+is%3Aissue+label%3a%22newcomer+friendly%22)
247278
and
248279
[awaiting pull request](https://github.com/commercialhaskell/stack/issues?q=is%3Aopen+is%3Aissue+label%3A%22awaiting+pull+request%22)
249280
labels.
250281
251-
If you need to check your changes quickly run `stack ghci` and then this command
252-
at the REPL's prompt:
282+
If you need to check your changes quickly command:
283+
284+
~~~text
285+
stack repl
286+
~~~
287+
288+
and then, at the REPL's prompt, command:
253289

254290
~~~text
255291
:main --stack-root=<path_to_root> --stack-yaml=<path_to_stack.yaml> <COMMAND>

0 commit comments

Comments
 (0)