Match against a pattern (value, nested object, or predicate). The result type R2 is added to the union of possible results.
Match multiple patterns (OR operation). The result type R2 is added to the union of possible results.
Add a case that matches a specific value. The result type R2 is added to the union of possible results.
Add a case that matches multiple values. The result type R2 is added to the union of possible results.
Default case - makes match non-exhaustive. The result type R2 is added to the union of possible results.
Force exhaustive matching (compile-time check for union types)
Get result if matched, throws if no match
Get result wrapped in Option
Match with a guard function (alias for readability). The result type R2 is added to the union of possible results.
Pattern matching construct similar to Scala's match expressions. Supports exhaustive matching, nested patterns, and guards.
Example
Example
Example