Hyperlinkv0.8.0-beta.28

Cause

Cause.filterInterruptorsconsteffect/Cause.ts:1065
<E>(self: Cause<E>): Result.Result<Set<number>, Cause<E>>

Returns a Result whose success value is the set of defined fiber IDs from the cause's Interrupt reasons. If the cause has no Interrupt reason, the failure value is the original cause.

When to use

Use when you need absence of interrupt reasons to fail with the original cause.

Gotchas

Interrupt reasons without a fiberId still count as interrupts, so the function succeeds with an empty Set when every interrupt reason has an undefined fiber ID.

Example (Extracting interruptors with Result)

import { Cause, Result } from "effect"

const result = Cause.filterInterruptors(Cause.interrupt(1))
if (!Result.isFailure(result)) {
  console.log(result.success) // Set(1) { 1 }
}
filteringinterruptors
Source effect/Cause.ts:10652 lines
export const filterInterruptors: <E>(self: Cause<E>) => Result.Result<Set<number>, Cause<E>> =
  effect.causeFilterInterruptors