Avatar
omochimetaru 3/6/2019 2:19 AM
Future Directionsのopaque type alias面白いな
2:19 AM
public typealias LazyCompactMapCollection<Elements, ElementOfResult> : some Collection<.Element == ElementOfResult> = LazyMapSequence< LazyFilterSequence< LazyMapSequence<Elements, ElementOfResult?> >, ElementOfResult > extension LazyMapCollection { public func compactMap<U>(_ transform: @escaping (Element) -> U?) -> LazyCompactMapCollection<Base, U> { // ... } public func filter(_ isIncluded: @escaping (Element) -> Bool) -> LazyCompactMapCollection<Base, Element> { // ... } }
2:19 AM
opaque return typeだけど、実際の型は2つの関数で同じだよって事を表明できるのか。