Either Type

Would this be the place to first implement an Either type? I can’t find the tweet at the moment but I remember @Ben_Cohen created one that was way faster than AnyCollection. I have been working on taking his implementation and modifying it to also support MutableCollection efficiently.

I don't think Swift Collections is the right place for a fully general Either type, however Swift Algorithms might be a good place to prove out the value of narrower EitherSequence type that conditionally conforms to the other collection protocols.

4 Likes