Higher Kinded Types (Again)

I think the best way forward would be to have a proposal (and implementation) for generic associatedtypes, or for generalized existentials, as I mentioned in the previous HKT thread.

Generic associated types would enable this definition:

typealias Functor = Mappable
protocol Mappable {
    associatedtype Element
    associatedtype Mappend<T>: Mappable
      where Mappend.Mappend == Mappend,
            Mappend.Element == T

    func map<T>(_ transform: (Element) -> T) -> Mappend<T>
}
3 Likes