the type of the "success" branch value
Readonly_Readonly[toReadonlyerrorPattern matches over the Try, applying onFailure if Failure and onSuccess if Success
Function to apply if the Try is Failure
Function to apply if the Try is Success
The result of applying the appropriate function
Async variant of fold. Accepts sync or async handlers on either branch and always returns a Promise.
Returns the contained value or null
Extract the value or throw an error
Returns the contained value or undefined
Converts this monad to an Either.
Conversion rules:
Converts this monad to an Option.
Conversion rules:
Returns a string representation of an object.
Converts this monad to a Try.
Conversion rules:
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
Base interface for sum-type containers (Either, Try, etc.) that are NOT iterables.
Unlike
FunctypeBase, this base deliberately excludesTraversable— which bundlesreduce/reduceRight/size/isEmpty. Those methods force A-invariance on their containers (signature(f: (A, A) => A) => Aputs A in both contravariant and covariant positions) and have no semantic meaning for disjoint-union types where the "success" branch is 0-or-1, not a collection.Sum types that extend
FunctypeSumcan be declared covariant in their type parameter (interface Foo<out A>) without structural check failures. This mirrors Scala's model:Either[+L, +R]andTry[+T]do not extendIterable; onlyOption[+A]extends the lighterIterableOnce[+A].Only the covariance-safe subset of
ContainerOpsis included inline:contains,exists, andforEachall place A only in contravariant (callback input) position.find(returnsOption<A>) andcountare intentionally omitted — if a sum type needs them it can declare them directly.