[swift-evolution] Proposal: An Either Type in the STL

Evan Maloney emaloney at gilt.com
Thu Dec 10 13:11:10 CST 2015


Kevin Ballard wrote:

> I do not support the addition of Either. As far as I am aware, the only
> compelling argument in favor of an Either type is "because Haskell has
> one", but I believe it's commonly recognized that Haskell's Either is
> not particularly good. It's a weird name for results (which Result
> covers), and for other cases it's usually better just to define your own
> two-variant enum anyway. Rust provides some evidence in favor of this,
> as this was the rationale for why Rust has a Result<T,E> but no Either,
> and it turns out there has been no need to add an Either.

I could not agree more. Either is a weird name, and trying to decipher the underlying meaning of 'left' and 'right' is maddening.

Result<T> or Result<T,E> would make a lot more sense for Swift.



More information about the swift-evolution mailing list