Skip to content

Commit 6d6394e

Browse files
committed
Improve documentation of Stack root
1 parent 389917f commit 6d6394e

File tree

1 file changed

+38
-14
lines changed

1 file changed

+38
-14
lines changed

doc/stack_root.md

+38-14
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ command line.
3535

3636
The default Stack root is `%APPDIR%\stack`.
3737

38-
If the `LOCALAPPDATA` environment variable exists, the default location of
39-
tools is `%LOCALAPPDATA%\Programs\stack`. Otherwise, it is the `programs`
38+
If the `LOCALAPPDATA` environment variable exists, then the default location
39+
of tools is `%LOCALAPPDATA%\Programs\stack`. Otherwise, it is the `programs`
4040
directory in the Stack root.
4141

4242
!!! warning
@@ -144,14 +144,27 @@ This is Stack's global configuration file. For further information, see the
144144
documentation for non-project specific
145145
[configuration](yaml_configuration.md#non-project-specific-configuration).
146146

147-
If the file is deleted, and Stack needs to consult it, Stack will create a file
148-
with default contents.
147+
If the file is deleted, and Stack needs to consult it, then Stack will create a
148+
file with default contents.
149149

150150
### `stack.sqlite3`
151151

152152
This is a 'user' database that Stack uses to cache certain information. The
153153
associated lock file is `stack.sqlite3.pantry-write-lock`.
154154

155+
### `.stack-work` directory (optional)
156+
157+
Stack can build when there is no project-level configuration file (including one
158+
in the `global-project` directory of the Stack root); for example, as a result
159+
of a [`stack script`](script_command.md) command (at the command line or in a
160+
[Stack interpreter options comment](scripts.md) in a Haskell script file). When
161+
it does so, the directory corresponding to a project directory is the Stack
162+
root. Stack will create its work directory, named `.stack-work` by default, in
163+
the Stack root.
164+
165+
If the work directory is deleted, and Stack needs that work directory, then
166+
Stack will recreate it.
167+
155168
### `global-project` directory
156169

157170
This contains:
@@ -162,13 +175,13 @@ This contains:
162175
* if created, Stack's working directory (`.stack-work`) for the global project.
163176

164177
If the project-level configuration file is deleted, and Stack needs to consult
165-
it, Stack will recreate the contents of the directory.
178+
it, then Stack will recreate the contents of the directory.
166179

167180
### `pantry\hackage` directory
168181

169182
This contains a local cache of the package index. If the contents of the
170-
directory are deleted, and Stack needs to consult the package index, Stack will
171-
seek to download the latest package index.
183+
directory are deleted, and Stack needs to consult the package index, then Stack
184+
will seek to download the latest package index.
172185

173186
!!! info
174187

@@ -185,8 +198,8 @@ This contains:
185198

186199
* the Pantry database used by Stack (`pantry.sqlite3`) and its associated lock
187200
file (`pantry.sqlite2.pantry-write-lock`). If the database is deleted, and
188-
Stack needs to consult it, Stack will seek to create and initialise it. The
189-
database is initialised with information from the package index; and
201+
Stack needs to consult it, then Stack will seek to create and initialise it.
202+
The database is initialised with information from the package index; and
190203
* a database of package versions that come with each version of GHC
191204
(`global-hints-cache.yaml`).
192205

@@ -200,7 +213,18 @@ installed Stack-supplied tool:
200213
* a directory for the tool.
201214

202215
To remove a Stack-supplied tool, delete all of the above. If Stack needs a
203-
Stack-supplied tool and it is unavailable, Stack will seek to obtain it.
216+
Stack-supplied tool and it is unavailable, then Stack will seek to obtain it.
217+
218+
### `scripts` directory (optional)
219+
220+
If the `--compile` or `--optimize` and `--use-root` flags are used with the
221+
[`stack script`](script_command.md) command, then this contains:
222+
223+
* script-specific locations, each containing all the compilation outputs
224+
(inclduing the executable) generated by the command.
225+
226+
If the `scripts` directory, or a script-specific location within it, is deleted,
227+
and Stack needs that directory, then Stack will recreate it.
204228

205229
### `setup-exe-cache` directory
206230

@@ -209,7 +233,7 @@ version of GHC (an associated version of Cabal (the library)) that Stack has
209233
used, an executable that Stack uses to access Cabal (the library).
210234

211235
If the contents of the directory are deleted, and Stack needs the executable,
212-
Stack will seek to rebuild it.
236+
then Stack will seek to rebuild it.
213237

214238
### `setup-exe-src` directory
215239

@@ -219,7 +243,7 @@ contains the two source files (`setup-<hash>.hs` and `setup-shim-<hash>.hs`)
219243
that Stack uses to build the executable.
220244

221245
If the contents of the directory are deleted, and Stack needs the executable,
222-
Stack will recreate them.
246+
then Stack will recreate them.
223247

224248
The hash in the names of the source files is a hash of arguments passed to GHC
225249
when building the executable and the contents of the two source files.
@@ -243,7 +267,7 @@ This contains a directory for each snapshot that Stack creates when building
243267
immutable dependencies of projects.
244268

245269
If the contents of the directory are deleted, and the snapshot is not available
246-
to Stack when it builds, Stack will recreate the snapshot.
270+
to Stack when it builds, then Stack will recreate the snapshot.
247271

248272
### `templates` directory
249273

@@ -252,7 +276,7 @@ further information, see the [`stack templates`](templates_command.md) command
252276
documentation.
253277

254278
If the contents of the directory are deleted, an Stack needs a project template,
255-
Stack will seek to download the template.
279+
then Stack will seek to download the template.
256280

257281
### `upload` directory
258282

0 commit comments

Comments
 (0)