Effect is to TypeScript what TypeScript is to Effect. It just pays off. But most of the learning curve or the unfamiliarity with syntax and even concepts goes away with AI. In fact, the same reasons why it makes it good for teams makes it good for AI. When a team member or an agent use the Effect patterns, I know I there is a lot less they could have messed up.
One issue with Effect is that it's hard to intro because it does many things. But it does them well, and it does all of them because only a coherent system can deliver the promise of allowing you to write production-ready TypeScript.
I'll list some things:
- Effects: how you describe programs. For some people it helps to think of them as promises on steroids. In addition to tracking the return type, they track the types of errors it could fail with, as well as its dependencies (see context/layers).
- Fibers: primitives for concurrency—but most of the time you don't have to think about them because the `Effect` methods handle most common scenarios
- Context/Layers: type-safe dependency injection. Have your cake and eat it too. You define context interfaces, use them within effects, and TypeScript forces you provide implementations of those interfaces via layers. Layers can provide more than one context, and can also depend on other layers. Very powerful.
- Schema: think Zod, but with the concept of codecs (to be fair Zod has this too), which means you define how things encode (e.g. what API takes and responds with) and decode (e.g. what my app works with). I love `Model`, which derives schemas for the API side and repo (db) side, so I can define a domain model declaratively with things like "account number should be replaced with * except the last 4 digits in the API; it should be Redacted (wrapped, can't leak to logs etc) within the app logic, and should be encrypted in the database".
- Standard library: lots of things that should standard in JS/TS and aren't, or exist but are not coherent or play well together.
When I don't use Effect, I have to choose between doing things well or shipping (and suffering the consequences). And I don't mean just strings, dates, decimals. I mean also queues, cache, etc.
- SQL primitives to work with transactions, migrations, queries. There are interfaces on top of this for popular ORMs.
- HTTP server; and ways to define your API with types and schemas, then implement it.
- Telemetry, logging by default
...and I could go on. I am not looking back.