Creates a custom error class with a .tag and typed .data.
Also provides a static .is(e) type guard.
Free-form matcher; chain .with() and .when(), then .otherwise().
Returns a matcher object that must end with .otherwise().
Exhaustive matcher; chain .with()/.when() and finish with .exhaustive().
TypeScript enforces that all All variants are covered.
Wraps a function to return a Result<T, E> instead of throwing.
Returns { ok: true, value: T } on success or { ok: false, error: E } on failure.
Utility guards for error matching.