<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">While it's definitely worth knowing, it's not a really usable substitute for higher-kinded types in production code, and still requires a lot of code generation, which is eased in Kotlin thanks to its annotation/metaprogramming features.<div class=""><br class=""></div><div class="">Event the Kategory people recognized that the emulation approach is a temporary solution, waiting for the approval of a proposal for the addition of HKTs to Kotlin itself.</div><div class=""><br class=""></div><div class="">Unfortunately, if we don't get HKTs in Swift we're simply going to miss on a barrage of extremely useful abstractions, upon that many contemporary languages have started to rely, because they are simply the best known solutions to many problems in many contexts.</div><div class=""><br class=""></div><div class="">The huge amount of work that's been done in academia in the last 15 years (and it's still going) about applicatives - and also profunctor optics, another thing that requires HKTs - is mostly going to elude Swift due to its crucial lack of expressivity.</div><div class=""><br class=""></div><div class="">We're on the right track with the approval of the conditional conformance proposal, but my fear is that the ABI stability requirement for Swift 5 is going to lock the language interfaces in a state where it's going to be impossible for these kinds of sophistications to be added to the language at a later stage... I hope to be proven wrong here.</div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">Elviro <br class=""><div><br class=""><blockquote type="cite" class=""><div class="">Il giorno 14 dic 2017, alle ore 15:40, Matthew Johnson via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> ha scritto:</div><div class=""><br class=""><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br class=""></div><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">Thanks for jumping in and elaborating on a more general approach! I don’t want to sidetrack the thread, but it actually is possible to encode higher-kindred types and protocols requiring them in Swift today. It’s a bit clunky and requires some boilerplate but the technique is worth knowing. <a href="https://gist.github.com/anandabits/f12a77c49fc002cf68a5f1f62a0ac9c4" class="">https://gist.github.com/anandabits/f12a77c49fc002cf68a5f1f62a0ac9c4</a></div><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br class=""></div><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">Some Kotlin folks have created a pretty robust FP library using the same technique: <a href="http://kategory.io/" class="">http://kategory.io/</a>.</div><br class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">_______________________________________________</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">swift-evolution mailing list</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a></span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a></span></div></blockquote></div><br class=""></div></body></html>