The Effect Kitchen
Effect for TypeScript, grades 7 and 8

One kitchen. One cook. A lot of smoothies.

Effect is a library that helps programmers write TypeScript that waits, fails, and cleans up without surprises. That sounds grown-up. It isn't. Every idea in it can be explained with a food truck, and that's what we're going to do.

Start with Lesson 1

Maya Sam Ty

Meet the cast

Sam, the cook

The only cook in the truck. Sam stands for the JavaScript engine: exactly one pair of hands, always doing one thing at a time.

Maya, the customer

Orders smoothies, gets receipts, holds recipe cards, and sometimes walks off before her order is ready. Maya stands for the code that asks for things.

Ty, the kitchen manager

Reads every recipe card before it reaches Sam. If a card forgot something, Ty stops it at the door. Ty stands for the TypeScript type checker.

The menu

Seven lessons. Each one adds a single new thing to the kitchen picture, so you never hold more than one new idea at a time.

Why a kitchen?

Because every hard word in this topic is really a kitchen word wearing a costume. "Asynchronous" is a toaster with a bell. A "Promise" is a receipt. An "Effect" is a recipe card. A "service" is a blender. A "fiber" is a bookmark. Once you can see the kitchen, the words stop being scary.

The code on these pages uses Effect 4.0 (release candidate). Every snippet was type-checked and run against effect@4.0.0-rc.118. There is very little code on purpose. The point this month is the ideas.