[swift-evolution] [proposal] Either in the Swift Standard Library
Developer
devteam.codafi at gmail.com
Thu Jan 14 20:22:18 CST 2016
Now that I think about it, `fold` is not a great name for the cata on Either, [too bad `either is taken!]. Rust calls it `unwrap_or`, so maybe `unwrapLeft`, `unwrap`, etc? Also, we’ve found some use for partial projections in JSON parsing libraries, so it might be worth looking into adding them to the proposal.
extension Either {
var fromLeft : LeftValue? {
switch self {
case let .Left(l):
return l
default:
return nil
}
}
var fromRight : RightValue? {
switch self {
case let .Right(r):
return r
default:
return nil
}
}
}
> On Jan 9, 2016, at 2:19 PM, Developer <devteam.codafi at gmail.com> wrote:
>
> Because the last discussion, while substantive and very much appreciated, did not debate the proposal much, I'd like to begin discussion anew about the addition of an Either type to the Swift Standard Library. The proposal can be found here (https://github.com/apple/swift-evolution/pull/67#issuecomment-170269481) and a link to the root our previous round of discussion is here (https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20151207/001394.html).
>
> Thanks all!
>
> ~Robert Widmann
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160114/317acd16/attachment.html>
More information about the swift-evolution
mailing list