Effect TS · Lesson 1 of 8
A mental model for a decision, not a syntax tour. You'll leave able to run your first Effect program and say precisely what it replaces.
You're evaluating Effect for your next service — a brand-new project where you pick the tools freely. This course ends with you writing an adopt-or-reject memo: a short document arguing for or against Effect, backed by a small working piece of a real service you build along the way. Lesson 1 gives you the mental model every later lesson builds on — and your first runnable program.
Calling Effect.succeed(42) does nothing. It returns a value that describes a computation — like a recipe card, not a cooked meal. Nothing happens until you hand the recipe to a runner such as Effect.runPromise1.
// recipe written, kitchen still cold
const program = Effect.succeed(42);
// NOW it runs
await Effect.runPromise(program); // → 42
You already know this shape: it's the difference between () => fetch(url) and fetch(url). Effect just makes every operation lazy like that — and laziness is what lets it add powers plain promises can't have: typed errors (failures listed in the type — lesson 2), retries and timeouts (lesson 3), dependency injection (pluggable parts — lesson 4), and test clocks (faking the passage of time in tests). Because a description is just data, Effect can inspect it and combine descriptions before anything runs2.
If you can't say "nothing runs until runPromise", re-read this section before the quiz. Everything else in Effect falls out of this one fact.
In the Meridian course you built by hand the exact problems Effect packages up and sells as solved. That's exactly why you can evaluate it quickly: you know the pain it offers relief from.
| You hand-rolled (plain TS) | Effect's packaged answer | Lesson |
|---|---|---|
| Errors as a list of named cases (a discriminated union), passed up through return types by hand | Every effect carries an error channel — the second slot in Effect<A, E> — tracked automatically3 | 2 |
withRetry loops that wait longer after each failed attempt (your BullMQ work) | Reusable Schedule values — retry plans as data: Effect.retry(effect, policy)4 | 3 |
| Functional core / imperative shell — pure logic inside, messy input/output at the edges — with dependencies passed in as parameters | Context.Tag + Layer — pluggable parts you can swap for test doubles5 | 4 |
| Checking data at the door ("parse, don't validate"): functions that build a valid value or refuse the input | Schema: define the shape once, get the runtime checks and the TypeScript types from it6 | 5 |
The evaluator's question is not "is this clever?" — it clearly is. It's "does the packaged version beat my hand-built one often enough to be worth its learning curve?" Watch both sides as we go.
Here's the shape of the bet. Left: the retry helper you've written per project. Right: the same behaviour as a value you can hand to any effect — HTTP call, queue write, DB query — no wrapper, no loop.
async function withRetry<T>(
fn: () => Promise<T>
): Promise<T> {
let delay = 100;
for (let i = 0; ; i++) {
try { return await fn(); }
catch (e) {
if (i >= 4) throw e;
await sleep(delay);
delay *= 2;
}
}
}
// ...and a second copy for timeouts,
// and a third for logging...
import { Effect, Schedule } from 'effect';
const policy = Schedule.recurs(5);
// any effect, one line:
const program =
chargeCard.pipe(Effect.retry(policy));
// compose more powers by adding
// combinators — not by rewriting
// the loop:
// Effect.timeout("5 seconds")
Doubling waits ("exponential backoff"), a dash of randomness ("jitter"), a hard limit on attempts ("capped retries") — each is just another Schedule piece you snap on, which we'll assemble properly in lesson 3. The point now: the retry policy is data, so you can build with it. Your loop, however tidy, can't be handed around.
This course teaches stable version 3 (3.22.1). Effect 4 is in release candidate — a near-final preview: fine to try, not yet the safe default7. In v4, the packages fold into one dependency-free effect package, and Either is renamed Result8. The concepts you learn here carry over almost unchanged. But "adopt now on v3 and migrate at v4" versus "wait for v4" is exactly the kind of judgement your final memo should make.
Official docs, about 15 minutes: Creating Effects, then Using Generators. Read them after the quiz — they'll confirm what you proved here. Prefer video? Matt Pocock's onboarding pitch is the best skeptic's framing of the same bet.
Anything unclear — the generator syntax, why laziness enables retries, what "description" really means — ask me before starting lesson 2. No question is too small; I designed this path for you and can re-route it anytime. When you're ready to hear how real teams live with Effect, the official Discord is where maintainers answer daily.