Skip to content

Advanced Types

Two powerful companions to Result<T> for modelling optional values and multi-outcome returns.

  • Maybe<T> — Operations Safe null handling with optionals — no null reference exceptions.

  • When to Use Maybe<T> Guidance on choosing between Maybe<T>, Result<T>, and nullable.

  • OneOf Unions Discriminated unions for 2–6 typed outcomes with exhaustive matching.

  • OneOf Arities & Conversions Arity 2–6, chain conversions, and mapping to Result<T> or IResult.

  • Convert to Result<T> or IResult ToResult(), ToIResult() — bridge OneOf to the Result pipeline or HTTP responses.

  • When to Use OneOf<...> vs Result<T> Decision guide — when each type fits best in your domain model.