Feature | fp-ts (Task/TaskEither) | Effect |
---|---|---|
Async primitive | Task<A> = () => Promise<A> (lazy) |
Effect<Out, Err, Req> (runnable via runPromise , etc.) |
Error channel | TaskEither<E, A> = () => Promise<Either<E, A>> |
Dedicated error channel in Effect<Out, Err, Req> |
Exception wrapping | tryCatch wraps thrown/rejected Promises into Left<E> |
Effect.try / Effect.tryPromise wrap sync/async functions |
Composition | pipe , chain , map , fold on TaskEither |
.pipe(Effect.map, Effect.chain, Effect.catchAll, …) |
Concurrency | No built-in fibers; manual via Promise.all |
First-class fibers with safe cancellation (Effect.fork ) |
Retry / Backoff | No built-in support; manual retries | Schedule library offers retry policies out of the box |
Resource safety (bracketing) | Manual try/finally around Task or TaskEither |
Effect.acquireRelease / Effect.bracket for cleanup |
Dependency injection & layers | None (custom Context needed) | Built-in Context and Layer modules |
Bundle size | Very small; type-level constructs, tree-shakeable | Larger core runtime plus optional modules; tree-shakeable |
Learning curve | Steep for HKTs and FP type classes | Steeper initial investment, but consistent for large systems |
Created
July 3, 2025 12:04
-
-
Save nagyadam2092/3c70fbc76cfc276d1aa49c7134c78704 to your computer and use it in GitHub Desktop.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://egghead.io/courses/professor-frisby-introduces-composable-functional-javascript