Skip to content

Commit a4ec6ad

Browse files
committed
Re #6540 Document stack-shim-<hash>.hs online
1 parent 5ec43ca commit a4ec6ad

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

doc/stack_root.md

+17
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,23 @@ that Stack uses to build the executable.
221221
If the contents of the directory are deleted, and Stack needs the executable,
222222
Stack will recreate them.
223223

224+
The hash in the names of the source files is a hash of arguments passed to GHC
225+
when building the executable and the contents of the two source files.
226+
227+
The content of the `setup-<hash>.hs` file is the familiar:
228+
229+
~~~haskell
230+
import Distribution.Simple
231+
main = defaultMain
232+
~~~
233+
234+
The content of the `setup-shim-<hash>.hs` file uses `main` except when the
235+
executable is called with arguments `repl` and `stack-initial-build-steps`. Then
236+
Stack makes use of Cabal's `defaultMainWithHooks` and `replHook` field to create
237+
the autogenerated files for every configured component; the `replHook` function
238+
is provided with the information that `initialBuildSteps` needs. Stack's
239+
`stack ghci` or `stack repl` commands call the executable with those arguments.
240+
224241
### `snapshots` directory
225242

226243
This contains a directory for each snapshot that Stack creates when building

0 commit comments

Comments
 (0)