Hyperlinkv0.8.0-beta.28

Exit

Exit.filterValueconsteffect/Exit.ts:598
<A, E>(self: Exit<A, E>): Result.Result<A, Failure<never, E>>

Extracts the success value from an Exit as a Result.

When to use

Use when composing Exit checks with Filter or other Result-based filtering APIs and you want the raw success value rather than the Success wrapper.

Details

Returns Result.succeed(value) when the Exit is a Success, or Result.fail(failure) with the original Failure otherwise.

Gotchas

This is not an Option accessor or an Effect failure. A failed extraction is represented as data in the Result failure channel.

Example (Filtering for the value)

import { Exit, Result } from "effect"

const exit = Exit.succeed(42)
const result = Exit.filterValue(exit)

console.log(Result.isSuccess(result) && result.success) // 42
Source effect/Exit.ts:5981 lines
export const filterValue: <A, E>(self: Exit<A, E>) => Result.Result<A, Failure<never, E>> = effect.exitFilterValue