on master help sign in
Doc: improve `FAQ.md`
commit08f95e38a7412c427e8f02e5ddf87a3732799e95 authorSebastien Mondet <seb@mondet.org> dateWed 17 Apr 2019, 14:30 (8 years ago) parentc918cac
1 file changed+19−18
FAQ.md+19−18
FAQ.md+19−18
@@ -66,11 +66,11 @@ then specify the package you want in the import, e.g:
6666
6767#### Short version:
6868
69−`ob run` starts a [`ndmitchell/ghcid`](https://github.com/ndmitchell/ghcid)
70−process, within a carefully crafted `nix-shell`, which tries to build your
71−project and,
69+`ob run` starts a [`ghcid`](https://github.com/ndmitchell/ghcid) process which
70+tries to build your project within a carefully crafted `nix-shell` with all the
71+project's dependencies and,
7272
73−* either displays compilation errors,
73+* either displays compilation errors/warnings,
7474* or starts the Obelisk server, which serves:
7575 * your backend's route handlers,
7676 * the static assets,
@@ -79,37 +79,38 @@ project and,
7979#### Longer version:
8080
8181Assuming we are in a project created with `ob init`, `ob run` calls (see
82−`./lib/command/src/Obelisk/Command.hs`):
82+`lib/command/src/Obelisk/Command.hs`):
8383
8484 nix-shell -A shells.ghc --run 'ob --no-handoff internal run-static-io <real-run-function>'
8585
8686where
8787
8888* `shells.ghc` is defined in `./default.nix` by importing `./.obelisk/impl/default.nix` which
89− is `./default.nix` in the present (Obelisk) repository,
89+ is `default.nix` in the present (Obelisk) repository,
9090* `run-static-io` is a logging-enabled command wrapper
91− (cf. `runObelisk` in `./lib/command/src/Obelisk/App.hs`).
91+ (cf. `runObelisk` in `lib/command/src/Obelisk/App.hs`).
9292
9393In this case, it runs the function `Obelisk.Command.Command.run` (defined in
94−`./lib/command/src/Obelisk/Command/Run.hs`).
94+`lib/command/src/Obelisk/Command/Run.hs`).
9595
96−* It creates a GHCid config from a Nix expression:
97− * which loads 3 packages: "backend", "common", "frontend", and
96+* It creates a GHCi config from a Nix expression which:
97+ * loads three packages: `backend`, `common`, `frontend`,
9898 * obtains a free port number.
9999* Then runs `ghcid`
100− * with a `--test` command that reruns `Obelisk.Run.run` at each restart.
100+ * with a command that reruns `Obelisk.Run.run` at each restart (option
101+ `--test`).
101102
102−It is defined in `./obelisk/lib/run/src/Obelisk/Run.hs`:
103+It is defined in `lib/run/src/Obelisk/Run.hs`:
103104
104−* It creates a thread (`forkIO`) which starts the main backend.
105− This runs `runSnapWithCommandLineArgs` and
106− * passes routes to the backend
107− (result of the `_backend_run` field of the `Backend x y` “user” record)
108− * or to `serveDefaultObeliskApp` (`./lib/backend/src/Obelisk/Backend.hs`) to
105+* It creates a thread which starts the main backend.
106+ This runs `runSnapWithCommandLineArgs` and passes routes:
107+ * to the backend (result of the `_backend_run` field of your
108+ implementation of the `Backend fullRoute frontendRoute` record),
109+ * or to `serveDefaultObeliskApp` (`lib/backend/src/Obelisk/Backend.hs`) to
109110 serve static assets.
110111* Starts `runWidget`
111112 which itself runs
112− [runSettingsSocket](https://hoogle.haskell.org/?hoogle=runSettingsSocket)
113+ [runSettingsSocket](https://hackage.haskell.org/package/warp-3.2.26/docs/Network-Wai-Handler-Warp.html#v:runSettingsSocket)
113114 (the *“TCP listen loop”*):
114115 * it binds to TCP socket, and
115116 * creates the HTTP connection manager