Why Effect Systems Matter
Make side effects and failures explicit and composable.
Why Effect Systems Matter
An effect system makes side effects, failures, and dependencies explicit and composable in the type system. Instead of hidden throws and ambient I/O, every effect is a value you can pass around, transform, and combine.
Problems With Raw async/throw
Plain async/await with throw hides crucial information: the function signature does not say what errors it can throw or what resources it needs.
async function getUser(id: number): Promise<User> {
// may throw NotFoundError, may throw NetworkError
// needs a database connection from... somewhere
// none of this is in the type
return await db.users.find(id);
}All lessons in this course
- Why Effect Systems Matter
- The Effect Type
- Composing Effects
- Error Channels and Dependencies