Readonly_Readonly[toReturns the right value, or calls the never-returning handler with the Left's value.
Use this when you have a helper like (msg) => fail(msg, 2) that terminates the
program — the result type is unconditionally R, so you avoid the TypeScript
narrowing trap where if (e.isLeft()) fail(...) fails to narrow e.value when
fail is an arrow function typed as (...): never.
Async variant of fold. Accepts sync or async handlers on either branch and always returns a Promise, keeping chains fluent when at least one branch is async.
ReadonlymapReturns the contained value or null
Extract the value or throw an error
Returns the contained value or undefined
Converts this monad to an Option.
Conversion rules:
Returns a string representation of an object.
ReadonlyvalueConverts this monad to an Either.
Conversion rules:
(err: Error) => E to thread the underlying Error's context into the Left.The value to use for the Left case when the source is empty/none/failure
An Either with the value as Right or the provided leftValue as Left
Custom JSON serialization that excludes getter properties.
Emits the canonical functype envelope with @functype: "Either" so
native JSON.stringify recursion (e.g. inside a plain object body)
produces a marker-bearing envelope that survives a round-trip through
Serialization.deserialize.
Converts this container to a Promise
The behavior depends on the implementing container:
A Promise that resolves or rejects based on the container's state
Converts this monad to a Try.
Conversion rules:
A Try containing Success with the value or Failure with an appropriate error
Left variant of Either. Discriminated by
_tag: "Left"withvalue: L.