Playground Wisdom: Threads Beat Async/Await
lucumr.pocoo.org/2024/11/18/threads-beat-async-awaitIt's been a few years since I wrote about my challenges with
async/await-based systems and how they just seem to not support back
pressure well]]. A few years later, I do not
think that this problem has subsided much, but my thinking and
understanding have perhaps evolved a bit. I'm now convinced that
async/await is, in fact, a bad abstraction for most languages, and we
should be aiming for something better instead and that I believe to be
thread.
Exploring Effect in TypeScript: Simplifying Async and Error Handling
tweag.io/blog/2024-11-07-typescript-effectEffect promises to improve TypeScript code by providing a set of modules and functions that are composable with maximum type-safety.
The term “effect” refers to an effect system, which provides a declarative approach to handling side effects. Side effects are operations that have observable consequences in the real world, like logging, network requests, database operations, etc.
The library revolves around the Effect<Success, Error, Requirements> type, which can be used to represent an immutable value that lazily describes a workflow or job.
Effects are not functions by themselves, they are descriptions of what should be done. They can be composed with other effects, and they can be interpreted by the Effect runtime system.
Before we dive into the project we will build, let’s look at some basic concepts of Effect.