@typesanitizer I think this is basically covered by the "fully generalized reverse generics" link at the bottom of the proposal, which links to this section of the Improving the UI of Generics thread. The syntax is slightly different from some Protocol
, but it fills the same role:
func evenValues<C: Collection>(in collection: C) -> <Output: Collection> Output
where C.Element == Int, Output.Element == Int
{
return collection.lazy.filter { $0 % 2 == 0 }
}