Try using an associated type for the result of foo(): protocol P { associatedtype R
static func foo<T>(_ v: T) -> R } Slava > On Jul 7, 2017, at 1:50 AM, Jens Persson via swift-users > <swift-users@swift.org> wrote: > > protocol P { > // … > // For example the following will not work: > // static func foo<T, R>(_ v: T) -> R > // Is there some other way? > // … > } > struct S2 : P { > static func foo<T>(_ v: T) -> (T, T) { > return (v, v) > } > } > struct S3 : P { > static func foo<T>(_ v: T) -> (T, T, T) { > return (v, v, v) > } > } > > (I'm guessing but am not sure that I've run into (yet) a(nother) situation > which would require higher kinded types?) > _______________________________________________ > swift-users mailing list > swift-users@swift.org > https://lists.swift.org/mailman/listinfo/swift-users _______________________________________________ swift-users mailing list swift-users@swift.org https://lists.swift.org/mailman/listinfo/swift-users