Effect fixes your TypeScript · Intro
An Effect is not a Promise. It's a blueprint.
A Promise starts running as soon as you create it. An Effect does nothing until you run it. It describes the work, with three slots: A (what it succeeds with), E (how it can fail), R (what it needs). Because it's a value, you can retry it, time it out, run ten at once, or swap its dependencies before it ever runs.
Comment below: Which slot surprised you?
Effect fixes your TypeScript: a series on the bugs you already ship, and how Effect makes them impossible. All code is real Effect v4 and was compiled before it went on screen. https://effect.website
Transcript
An Effect is not a Promise. It's a blueprint. A Promise starts running the moment you create it. Watch. Log, create the promise, log. It already ran. You can't retry it. You can't cancel it. You can only wait for it. An Effect does nothing until you run it. It's a description of work with three slots. A, what it succeeds with. E, how it can fail. R, what it needs to run. Effect<A, E, R>. And because it's a blueprint, you can change the plan before it runs. Retry it. Time it out. Run 10 at once. Swap what it needs. Best practice, build your program as values and run it once at the edge. Every part of this series is about one of those slots. Start at part one. Which slot surprised you?




