Package: effect
Module: FiberSet
Creates a scoped FiberSet for storing fibers.
Details
When the associated Scope is closed, all fibers in the set will be
interrupted. You can add fibers to the set using FiberSet.add or
FiberSet.run, and the fibers will be automatically removed from the
FiberSet when they complete.
Example (Creating a scoped FiberSet)
import { Effect, FiberSet } from "effect"
Effect.gen(function*() {
const set = yield* FiberSet.make()
// run some effects and add the fibers to the set
yield* FiberSet.run(set, Effect.never)
yield* FiberSet.run(set, Effect.never)
yield* Effect.sleep(1000)
}).pipe(
Effect.scoped // The fibers will be interrupted when the scope is closed
)
Signature
declare const make: <A = unknown, E = unknown>() => Effect.Effect<FiberSet<A, E>, never, Scope.Scope>
Since v2.0.0