Result Type

Noun · Development

Definitions

  1. An algebraic type that represents either a success value or an error, forcing callers to explicitly handle both outcomes at compile time instead of relying on exceptions or null checks. Rust's Result<T, E>, Haskell's Either, Swift's Result, and Kotlin's Result all encode fallibility in the type system so errors cannot be silently ignored.

    In plain English: A special type that wraps a value and says 'this is either a success or an error' — the code won't compile unless you deal with both possibilities.

    Example: "The function returns Result<User, DbError> — you have to match on Ok or Err before you can access the user, so unhandled errors are impossible."

Related Terms