1# Forking: Renamed Combinators and New Options
2
3The `fork*` family of combinators has been renamed in v4 for clarity, and all
4variants now accept an options object for controlling fiber startup behavior.
5
6## Renamings
7
8| v3 | v4 | Description |
9| ----------------------------- | ------------------- | -------------------------------------------- |
10| `Effect.fork` | `Effect.forkChild` | Fork as a child of the current fiber |
11| `Effect.forkDaemon` | `Effect.forkDetach` | Fork detached from parent lifecycle |
12| `Effect.forkScoped` | `Effect.forkScoped` | Fork tied to the current `Scope` (unchanged) |
13| `Effect.forkIn` | `Effect.forkIn` | Fork in a specific `Scope` (unchanged) |
14| `Effect.forkAll` | — | Removed |
15| `Effect.forkWithErrorHandler` | — | Removed |
16
17## `Effect.fork` → `Effect.forkChild`
18
19**v3**
20
21```ts
22import { Effect } from "effect"
23
24const fiber = Effect.fork(myEffect)
25```
26
27**v4**
28
29```ts
30import { Effect } from "effect"
31
32const fiber = Effect.forkChild(myEffect)
33```
34
35## `Effect.forkDaemon` → `Effect.forkDetach`
36
37**v3**
38
39```ts
40import { Effect } from "effect"
41
42const fiber = Effect.forkDaemon(myEffect)
43```
44
45**v4**
46
47```ts
48import { Effect } from "effect"
49
50const fiber = Effect.forkDetach(myEffect)
51```
52
53## Fork Options
54
55In v4, `forkChild`, `forkDetach`, `forkScoped`, and `forkIn` all accept an
56optional options object with the following fields:
57
58```ts
59{
60 readonly startImmediately?: boolean | undefined
61 readonly uninterruptible?: boolean | "inherit" | undefined
62}
63```
64
65- **`startImmediately`** — When `true`, the forked fiber begins executing
66 immediately rather than being deferred. Defaults to `undefined` (deferred).
67- **`uninterruptible`** — Controls whether the forked fiber can be interrupted.
68 `true` makes it uninterruptible, `"inherit"` inherits the parent's
69 interruptibility, and `undefined` uses the default behavior.
70
71**Usage as data-last (curried)**
72
73```ts
74import { Effect } from "effect"
75
76const fiber = myEffect.pipe(
77 Effect.forkChild({ startImmediately: true })
78)
79```
80
81**Usage as data-first**
82
83```ts
84import { Effect } from "effect"
85
86const fiber = Effect.forkChild(myEffect, { startImmediately: true })
87```
88
89## Removed Combinators
90
91**`Effect.forkAll`** and **`Effect.forkWithErrorHandler`** have been removed in
92v4. For `forkAll`, fork effects individually with `forkChild` or use
93higher-level concurrency combinators. For error handling on forked fibers,
94observe the fiber's result via `Fiber.join` or `Fiber.await`.