# Adding Either type to the Standard Library

**URL:** <https://forums.swift.org/t/adding-either-type-to-the-standard-library/36972>\
**Category:** Discussion\
**Tags:** stdlib\
**Created:** [May 28, 2020, 7:00pm UTC](https://forums.swift.org/t/adding-either-type-to-the-standard-library/36972 "2020-05-28T19:00:24Z")\
**Posts on this page:** 1\
**Showing post:** 117

<div class="post-metadata">

**Author:** ![DevAndArtist](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/devandartist/32/287_2.png) [@DevAndArtist](https://forums.swift.org/u/DevAndArtist)\
**Post date:** [June 6, 2020, 4:28am UTC](https://forums.swift.org/t/adding-either-type-to-the-standard-library/36972/117 "2020-06-06T04:28:04Z")

</div>

Basically an `Either<A, A>` (or similar) type could have the following extension:

```swift
// extension<T> Either<T, T> {
extension Either where First == Second {
  var value: First {
    switch self {
    case .first(let value),
         .second(let value):
      return value
    }
  }
}

```

Of this could be a non-throwing `get()` method similar to `Result`.

However I do not advocate for the inclusion of `Either` into stdlib with this.

---

_[View the full topic](https://forums.swift.org/t/adding-either-type-to-the-standard-library/36972)._
