the type of the "success" branch value
the discriminant tag (e.g., "Left" | "Right", "Success" | "Failure")
Custom JSON serialization. Returns the canonical @functype-marked
envelope object so native JSON.stringify (and the rest of the JSON
toJSON protocol) emits a round-trip-able shape that
Serialization.deserialize can reconstruct.
Added in 1.2.0. Concrete types narrow the return to their specific marker/tag literals.
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.