Skip to content

Left

Defined in: src/util/Either.ts:34

The Left branch — by convention the error / alternative.

L

new Left<L>(value): Left<L>

Defined in: src/util/Either.ts:36

L

Left<L>

readonly _tag: "Left"

Defined in: src/util/Either.ts:35


readonly value: L

Defined in: src/util/Either.ts:36

bimap<U, V>(onLeft, _onRight): Either<U, V>

Defined in: src/util/Either.ts:51

Map BOTH sides.

U

V

(l) => U

(r) => V

Either<U, V>


flatMap<R2>(_f): Either<L, R2>

Defined in: src/util/Either.ts:45

Right-biased flatMap — Left passes through.

R2

(r) => Either<L, R2>

Either<L, R2>


fold<T>(onLeft, _onRight): T

Defined in: src/util/Either.ts:56

Collapse to a single value.

T

(l) => T

(r) => T

T


forEach(_f): void

Defined in: src/util/Either.ts:74

Side-effect runs on Right; no-op on Left.

(r) => void

void


getOrElse<U>(fallback): U

Defined in: src/util/Either.ts:62

Left → fallback.

U

U | ((l) => U)

U


isLeft(): this is Left<L>

Defined in: src/util/Either.ts:38

this is Left<L>


isRight(): this is Right<never>

Defined in: src/util/Either.ts:39

this is Right<never>


map<U>(_f): Either<L, U>

Defined in: src/util/Either.ts:42

Right-biased map — Left passes through.

U

(r) => U

Either<L, U>


mapLeft<U>(f): Either<U, never>

Defined in: src/util/Either.ts:48

Map the Left side.

U

(l) => U

Either<U, never>


orElse<R2>(alt): Either<L, R2>

Defined in: src/util/Either.ts:69

Left → alternative; Right → self.

R2

Either<L, R2> | (() => Either<L, R2>)

Either<L, R2>


swap(): Either<never, L>

Defined in: src/util/Either.ts:59

Swap the sides.

Either<never, L>


toNullable(): null

Defined in: src/util/Either.ts:77

Optional conversion — Left → null.

null