I have a lazy sequence I do some operations on and want to return from a function
func getSeq() -> ??? {
let a = array.lazy
./* ... operations like map, filter, etc */
}
The final type of a
is:
LazyMapSequence<FlattenSequence<LazyMapSequence<LazyFilterSequence<LazySequence<[[ComponentId] : ArchetypeId]>.Elements>.Elements, Zip2Sequence<Zip2Sequence<[C1], [C2]>, [C3]>>>, (C1, C2, C3)>
now how do I return a without having to specify the return type as that long type?
CodePudding user response:
Opaque result types exist for exactly this purpose. You can use them in conjunction with primary associated types.
You would say your function returns some Sequence<Element>