[swift-evolution] [Proposal] Higher Kinded Types (Monads, Functors, etc.)

Krzysztof Siejkowski krzysztof at siejkowski.net
Thu Dec 17 08:43:18 CST 2015


This is directed to the thread/discussion in general, not any specific person: I think it was said before but it is probably worth repeating: Whether the type system should allow HKT or not doesn't necessarily have anything to do with the names and data structures of the stdlib.


Well said! Could we steer the discussion in the right direction by identifying what exact features of type system are needed?



Some questions that come to mind:

1) Do we need ability to express covariance and contravariance of generic types?

2) Do we need a better mechanism for ad-hoc polymorphism, similar to Haskell's typeclasses?

3) How should type constraints (`where` clause) be extended?



Some of those questions are already discussed in other threads, so it’s mainly a matter of ensuring that the upcoming proposals are powerful enough.


Krzysztof





For example, a Mappable protocol (let's call it that rather than Functor) is currently not even _possible_ to write, and I believe this is the question to consider, i.e. whether Swift's type system should be allowed to express types that are parameterized not only by concrete types but also by parameterized types, for example if a return type could be Self<T> or just Self.

It would be sad if the question about HKT turned into yet another fruitless and meaningless functional vs imperative debate (see the talk *-Oriented Programming by Graham Lee).

/Jens

On Thursday, December 17, 2015, Will Fancher via swift-evolution <swift-evolution at swift.org> wrote:
I'm not sure I follow? Are you suggesting that having HKTs at all will encourage Swift programmers to use bad naming conventions? I don't think the two are related unless you're talking about people using a Monad library, in which case it will be the Monad library using and encouraging bad naming conventions, not HKTs themselves.
_______________________________________________
swift-evolution mailing list
swift-evolution at swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution


--
bitCycle AB | Smedjegatan 12 | 742 32 Östhammar | Sweden
http://www.bitcycle.com/
Phone: +46-73-753 24 62
E-mail: jens at bitcycle.com


 _______________________________________________
swift-evolution mailing list
swift-evolution at swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20151217/c87d61b1/attachment-0001.html>


More information about the swift-evolution mailing list