[swift-evolution] [proposal] Either in the Swift Standard Library
greg at omnigroup.com
Tue Jan 26 11:40:08 CST 2016
> On Jan 26, 2016, at 9:30 AM, Developer via swift-evolution <swift-evolution at swift.org> wrote:
>> - occasionally: a rather poorly-named, 2-way sum type (poorly-named b/c its convention won’t generalize to 3-way sums, or 4-ways sums, etc.)
> Good thing Either<Either<...>, Either<...>> works.
This is another example of exactly why Either is terrible in practice. I understand that from a type algebra point of view this is perfectly reasonable and clean and that a 2-way sum is all that is necessary because larger sums are easily created by construction. Type theory-wise it’s lovely.
But from a literate programming point of view, when will "case let .Left(.Left(a)): case let .Left(.Right(b)): case let .Right(.Left(c)): case let .Right(.Right(d)): “ ever be the most understandable way to express _anything_ in Swift? And why would we want to encourage such things?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the swift-evolution