# Mission: Effect (TypeScript)

## Why
You want to write TypeScript — including React apps — where failures, retries, cancellation, and dependencies are *in the type* instead of living in `try/catch` folklore and implicit context. [Issue #23](https://github.com/ayv4zyan/teach/issues/23) is the brief: learn the Effect library from first principles, with enough fluency to adopt it gradually (or refuse it) in an existing codebase.

## Success looks like
- Read `Effect<A, E, R>` out loud and know what has *not* happened yet
- Choose Effect over `Promise` / `async`–`await` when typed errors, interruption, retries, or services actually pay rent — and leave it out when they do not
- Build programs with `Effect.gen` (and the constructors), then run them at the edge (`runPromise` / `runFork` / `runSync` when it is truly sync)
- Handle typed errors; provide services through Context and Layers
- Use cancellation, concurrency, retries, timeouts, and resource cleanup without ad-hoc `AbortController` trees
- Reach for Schema, logging, and config when they are the job — not as decoration
- Drop Effect into a React app at the right boundary, without pretending it replaces React state, rendering, or hooks
- Use `@effect/language-service` as the everyday compiler, not an optional plugin
- Explain the tradeoff to a teammate who only knows Promises

## Constraints
- Hands-on, compared to ordinary TypeScript. Small programs beat slogans.
- Follow the published docs on [effect.website](https://effect.website) (current documented API). Effect v4 is a release candidate on `effect@rc`; do not silently switch APIs.
- React examples when a UI is needed. Effect does not replace React.
- Gradual adoption: wrap a Promise, run back out. No “rewrite the app” fantasy.

## Out of scope
- Becoming an Effect core contributor
- Haskell/Scala theory for its own sake (inspiration is fine; the job is TypeScript)
- Shipping a production Effect+React app inside this teaching folder
- Treating `@effect/platform`, SQL, HTTP, cluster, etc. as the first mountain — they come after the core type, runtime, errors, and services
