<div dir="ltr">Bump</div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jul 1, 2016 at 11:56 AM, T.J. Usiyan <span dir="ltr"><<a href="mailto:griotspeak@gmail.com" target="_blank">griotspeak@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><br></div><div><br></div><div>## The Issue</div><div>Given </div><div>``` swift</div><div>public protocol Zipper1D : CustomStringConvertible {</div><div> associatedtype Element</div><div>}</div><div>```</div><div><br></div><div>We can almost write a `flatMap` which keeps the general identity of self and swaps out the Element in the output.</div><div><br></div><div>``` swift</div><div>func flatMap<</div><div> NewElement, SegmentOfResult : Collection, Output : Zipper1D where</div><div> SegmentOfResult.Iterator.Element == NewElement, Output.Element == NewElement></div><div> (_ transform: @noescape (Element) throws -> SegmentOfResult) rethrows -> Output</div><div>```</div><div><br></div><div>## The Proposal</div><div>I propose that we allow `Type.withoutSpecialization`</div><div><br></div><div>``` swift</div><div>func flatMap<</div><div> NewElement, SegmentOfResult : Collection, Output : Zipper1D where</div><div> SegmentOfResult.Iterator.Element == NewElement, Output.Element == NewElement, Output.withoutSpecialization == Self.withoutSepcialization></div><div> (_ transform: @noescape (Element) throws -> SegmentOfResult) rethrows -> Output</div><div>```</div><div><br></div><div><br></div><div>I recognize that generic protocols are another possible solution to this problem. I am pitching this because of how much closer this idea seems to being realized.</div></div>
</blockquote></div><br></div>