<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Do these papers contain examples of generic use of HKTs that wouldn’t be possible with a little bit of copy and paste boilerplate? Or do they mostly contain use of concrete types that implement some typeclasses?<div class=""><br class=""></div><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Dec 16, 2015, at 4:40 PM, T.J. Usiyan via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">The ideal situation would involve being able to represent monad and being able to type alias the behavior that that would afford us 'for free' to specific named functions methods for our specific types, I think.<div class=""><br class=""></div><div class="">The concrete example of a HKT's usefullness that I am after is captured here with [Causal Commutative Arrows](<a href="http://cs.yale.edu/c2/images/uploads/ICFP-CCA.pdf" class="">http://cs.yale.edu/c2/images/uploads/ICFP-CCA.pdf</a>). I admit that the big win has to do with the compile time optimization afforded, but I will argue that the syntax's similarity to audio related pseudocode is just as big of a win. [These slides](<a href="http://static1.squarespace.com/static/53e04d59e4b0c0da377d20b1/t/541cb6eee4b0be37af62e23f/1411167982496/nichoiceICFP2014Presentation.pdf" class="">http://static1.squarespace.com/static/53e04d59e4b0c0da377d20b1/t/541cb6eee4b0be37af62e23f/1411167982496/nichoiceICFP2014Presentation.pdf</a>) give a hint at what I am talking about. I agree that using "Monad" everywhere is not generally descriptive but I think that that is simply an issue of being able to document intent.</div><div class=""><br class=""></div><div class="">TJ</div></div><div class="gmail_extra"><br class=""><div class="gmail_quote">On Wed, Dec 16, 2015 at 5:11 PM, Will Fancher via swift-evolution <span dir="ltr" class=""><<a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Admittedly, the majority of my reasoning for higher kinded types comes from wanting Monads to be an available abstraction. I've been writing a lot of generic code, and finding that a lot of my types are Monads, which leads me to repeat many functions for each of these types, when those functions could be abstracted.<br class="">
<br class="">
The fact is, most generic types can be Functors, and a lot of them can be Monads. Therefore, having generics at all suggests that the language will have a lot of these kinds of types. The standard library doesn't have many. Optionals and the various collection protocols make up the majority of them. So developers who can rely mostly on the standard library using concrete types probably have everything they need in this area. But creating one's own generic types will very often lead to reimplementing the same Monad / Applicative / Functor utility functions. I can't tell you how many times I've copy-pasted my sequence function and changed only the type signature. Futures, Eithers, and Streams are three examples of types I've been implementing as Monads, which has lead to a lot of repetition.<br class="">
<br class="">
It is my personal opinion that Monads come up often enough that having proper support for them would be worthwhile. But I suppose the average Swift programmer may not run into these things as often as I do, so it makes sense that HKTs are low on the Swift team's priorities.<br class="">
<div class="HOEnZb"><div class="h5">_______________________________________________<br class="">
swift-evolution mailing list<br class="">
<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class="">
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class="">
</div></div></blockquote></div><br class=""></div>
<img src="https://u2002410.ct.sendgrid.net/wf/open?upn=eLFMrKDT8iBxZ-2Fbnk-2BZqvSchNN-2FvYXdceA0T7VxwkAf3bIIU68j7NrM50CK4nQn05-2FReB8Da1-2F7wvVhcigUQQeR2csVx88RWsINO3X58l9An-2Fgc1RCgTOxQBN-2B68CT215f5C1d8o-2BSoKy0E1vQvegigtXOy7cspbswNliekWHJmFgxna2G-2FcC7eIB0vUPH5YDXlRMwVICfx8eo-2BsqdzXkD3YYs1rFux1JZ-2FSfrzZvCw-3D" alt="" width="1" height="1" border="0" style="height:1px !important;width:1px !important;border-width:0 !important;margin-top:0 !important;margin-bottom:0 !important;margin-right:0 !important;margin-left:0 !important;padding-top:0 !important;padding-bottom:0 !important;padding-right:0 !important;padding-left:0 !important;" class="">
_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class="">https://lists.swift.org/mailman/listinfo/swift-evolution<br class=""></div></blockquote></div><br class=""></div></body></html>