<div dir="ltr">I periodically kill all hope that we might get higher-kinded-types, just to remain sane. <div><br></div><div>It's interesting that you would make them sound like a possibility though, since Mr Widmann said something about you declaring them intractable for some reason or another. </div><div><br></div><div>Well, this attempt to get them by hook or crook failed, but I won't let that get me down. No. No I won't.<br><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Jul 2, 2016 at 11:40 AM, Dave Abrahams via swift-evolution <span dir="ltr"><<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5"><br>
<br>
on Fri Jul 01 2016, "T.J. Usiyan via swift-evolution" <<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>> wrote:<br>
<br>
> Bump<br>
><br>
> On Fri, Jul 1, 2016 at 11:56 AM, T.J. Usiyan<br>
> <<a href="mailto:griotspeak@gmail.com">griotspeak@gmail.com</a>> wrote:<br>
><br>
>><br>
>><br>
>> ## The Issue<br>
>> Given<br>
>> ``` swift<br>
>> public protocol Zipper1D : CustomStringConvertible {<br>
>> associatedtype Element<br>
>> }<br>
>> ```<br>
>><br>
>> We can almost write a `flatMap` which keeps the general identity of self<br>
>> and swaps out the Element in the output.<br>
>><br>
>> ``` swift<br>
>> func flatMap<<br>
>> NewElement, SegmentOfResult : Collection, Output : Zipper1D where<br>
>> SegmentOfResult.Iterator.Element == NewElement, Output.Element ==<br>
>> NewElement><br>
>> (_ transform: @noescape (Element) throws -> SegmentOfResult)<br>
>> rethrows -> Output<br>
>> ```<br>
>><br>
>> ## The Proposal<br>
>> I propose that we allow `Type.withoutSpecialization`<br>
>><br>
>> ``` swift<br>
>> func flatMap<<br>
>> NewElement, SegmentOfResult : Collection, Output : Zipper1D where<br>
>> SegmentOfResult.Iterator.Element == NewElement, Output.Element ==<br>
>> NewElement, Output.withoutSpecialization == Self.withoutSepcialization><br>
>> (_ transform: @noescape (Element) throws -> SegmentOfResult)<br>
>> rethrows -> Output<br>
>> ```<br>
>><br>
>><br>
>> I recognize that generic protocols are another possible solution to this<br>
>> problem. I am pitching this because of how much closer this idea seems to<br>
>> being realized.<br>
<br>
</div></div>The right answer to this problem is something called “higher-kinded<br>
types,” which are interesting to contemplate for the future, but most<br>
definitely out-of-scope at the moment.<br>
<br>
Cheers,<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
-Dave<br>
<br>
_______________________________________________<br>
swift-evolution mailing list<br>
<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br>
</font></span></blockquote></div><br></div></div></div>