FuncType - v0.45.0
    Preparing search index...

    Interface ExitType<E, A>

    Exit represents the outcome of running an IO effect.

    • Success: The effect completed successfully with a value
    • Failure: The effect failed with a typed error
    • Interrupted: The effect was cancelled/interrupted
    interface ExitType<E extends Type, A extends Type> {
        _tag: ExitTag;
        flatMap<B extends unknown>(f: (a: A) => ExitType<E, B>): ExitType<E, B>;
        fold<T>(
            onFailure: (e: E) => T,
            onSuccess: (a: A) => T,
            onInterrupted?: (fiberId: string) => T,
        ): T;
        isFailure(): this is ExitType<E, A> & { _tag: "Failure"; error: E };
        isInterrupted(): this is ExitType<E, A> & {
            _tag: "Interrupted";
            fiberId: string;
        };
        isSuccess(): this is ExitType<E, A> & { _tag: "Success"; value: A };
        map<B extends unknown>(f: (a: A) => B): ExitType<E, B>;
        mapBoth<E2 extends unknown, B extends unknown>(
            onError: (e: E) => E2,
            onSuccess: (a: A) => B,
        ): ExitType<E2, B>;
        mapError<E2 extends unknown>(f: (e: E) => E2): ExitType<E2, A>;
        match<T>(
            patterns: {
                Failure: (error: E) => T;
                Interrupted: (fiberId: string) => T;
                Success: (value: A) => T;
            },
        ): T;
        orElse(defaultValue: A): A;
        orThrow(): A;
        toEither(): Either<E, A>;
        toJSON(): { _tag: ExitTag; error?: E; fiberId?: string; value?: A };
        toOption(): Option<A>;
        toString(): string;
        toValue(): { _tag: ExitTag; error?: E; fiberId?: string; value?: A };
    }

    Type Parameters

    Index

    Properties

    _tag: ExitTag

    Methods

    • Pattern matches over the Exit

      Type Parameters

      • T

      Parameters

      • onFailure: (e: E) => T
      • onSuccess: (a: A) => T
      • OptionalonInterrupted: (fiberId: string) => T

      Returns T

    • Type guard to check if this is a Failure

      Returns this is ExitType<E, A> & { _tag: "Failure"; error: E }

    • Type guard to check if this is Interrupted

      Returns this is ExitType<E, A> & { _tag: "Interrupted"; fiberId: string }

    • Type guard to check if this is a Success

      Returns this is ExitType<E, A> & { _tag: "Success"; value: A }

    • Maps the success value

      Type Parameters

      • B extends unknown

      Parameters

      • f: (a: A) => B

      Returns ExitType<E, B>

    • Maps both error and success values

      Type Parameters

      • E2 extends unknown
      • B extends unknown

      Parameters

      • onError: (e: E) => E2
      • onSuccess: (a: A) => B

      Returns ExitType<E2, B>

    • Maps the error value

      Type Parameters

      • E2 extends unknown

      Parameters

      • f: (e: E) => E2

      Returns ExitType<E2, A>

    • Pattern matches over the Exit with object patterns

      Type Parameters

      • T

      Parameters

      • patterns: {
            Failure: (error: E) => T;
            Interrupted: (fiberId: string) => T;
            Success: (value: A) => T;
        }

      Returns T

    • Returns the success value or a default

      Parameters

      • defaultValue: A

      Returns A

    • Returns the success value or throws

      Returns A

    • Converts to Either (Right for Success, Left for Failure) Throws if Interrupted

      Returns Either<E, A>

    • JSON serialization

      Returns { _tag: ExitTag; error?: E; fiberId?: string; value?: A }

    • Converts to Option (Some for Success, None otherwise)

      Returns Option<A>

    • String representation

      Returns string

    • Returns the raw value for inspection

      Returns { _tag: ExitTag; error?: E; fiberId?: string; value?: A }