You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently FlattenSequence does not conditionally conform to LazySequenceProtocol when its base does, however, this behavior is supported through this implementation in the standard library:
extensionLazySequenceProtocolwhere Element:Sequence{/// Returns a lazy sequence that concatenates the elements of this sequence of/// sequences.@inlinable// lazy-performancepublic__consumingfunc joined()->LazySequence<FlattenSequence<Elements>>{returnFlattenSequence(_base: elements).lazy
}}
This is an uncommon and convoluted way to add lazy behavior to FlattenSequence (when base does), the classic approach in the standard library is the following one:
This minor issue may feel awkward because the returning type of someSequenceOfSequence.lazy.joined() is not FlattenSequence<LazySequence<...>> as expected but LazySequence<FlattenSequence<...>>.
Fixing this would reduce the number of overloads of the joined() method to 1 and make the standard library more consistent.
The text was updated successfully, but these errors were encountered:
Additional Detail from JIRA
md5: 428272cf422670a09b2e579ae777d8bf
Issue Description:
Currently FlattenSequence does not conditionally conform to LazySequenceProtocol when its base does, however, this behavior is supported through this implementation in the standard library:
This is an uncommon and convoluted way to add lazy behavior to FlattenSequence (when base does), the classic approach in the standard library is the following one:
This minor issue may feel awkward because the returning type of
someSequenceOfSequence.lazy.joined()
is notFlattenSequence<LazySequence<...>>
as expected butLazySequence<FlattenSequence<...>>
.Fixing this would reduce the number of overloads of the
joined()
method to 1 and make the standard library more consistent.The text was updated successfully, but these errors were encountered: