Fiber, the fundamental unit of concurrency in Effect. Fibers are lightweight, user-space threads that allow multiple Effects to run concurrently with structured concurrency guarantees.
Overview
Fibers are the building blocks of concurrent programming in Effect:- Lightweight: Much lighter than OS threads, you can create millions
- Structured concurrency: Parent fibers manage child fiber lifecycles
- Cancellation safety: Proper resource cleanup when interrupted
- Cooperative: Fibers yield control at effect boundaries
- Traceable: Each fiber has an ID for debugging and monitoring
Basic Usage
Types
Fiber
id: Unique fiber identifiercurrentOpCount: Number of operations executedservices: Service context for the fibercurrentScheduler: Scheduler managing the fiber
Creating Fibers
Fibers are typically created usingEffect.forkChild:
