[Pitch] Result<T> enum

We all love enums!
Every time when I am adding Result to project, I wonder why it is not included in stdlib.

enum Result<T> {
  case success(T)
  case failure(Error)

  public init(_ value: T) {
      self = .success(value)

  public init(_ error: Error) {
      self = .failure(error)

This is very powerful type while using it with Swift pattern matching operators like switch or if-case .

1 Like

This has been already proposed. The current state is that we cannot add it at this point of time because we have to decide about optionally typed throws first.

Here is the proposal. And here is the thread.