import { Effect } from "effect"
const persist = Effect.sync(() => { saved = true })
persist // ← created, but never run
The most common bug in new Effect code is creating an Effect at the top of a function and forgetting to yield*, pipe, or run it. The type system will not warn you — an unused Effect is just an unused value.
Watch out. If your side effects never fire, the first thing to check
is: did anything actually run this Effect? Look for an Effect-valued
expression on a line by itself, with no yield* and no runner.
Rule of thumb. TypeScript will not flag a discarded Effect value
as suspicious — it’s just an unused expression. Linters (no-unused-expressions)
can help catch the bare-name-on-a-line shape, but they won’t catch
the more subtle “I built it and threw it away” inside a function.
Your turn: the first assertion shows saved === false after persist sits alone on a line — read it as the bug. Then replace the stub with Effect.runSync(persist) so the second assertion sees saved === true.
Same value, different fate.