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
{{ message }}
Repository navigation
The behavior of stream seems somewhat odd; perhaps it shouldn't be Operation<X> #976
The documentation at Effection Collections mentions that Stream corresponds to AsyncIterable, but in practice, AsyncIterable -> AsyncIterator does not require await during usage:
constdelay=(x: number)=>newPromise(r=>setTimeout(r,x));(async()=>{conststream: AsyncIterable<number>=(asyncfunction*(){awaitdelay(100)yield1awaitdelay(100)yield2awaitdelay(100)yield3})();constsubcription1=stream[Symbol.asyncIterator]()// No `await` on the stream itself// const subcription2 = ...console.log(awaitsubcription1.next())// ....})()
There are two different subscriptions created here, and it feels like merely using yield* to wait for an Operation<X> creates a new task, whereas await waiting for a Promise<X> does not.
Nowadays, for the same functionality, I think the following expression in Effection is better:
Hmm, what about Stream? Maybe the signature of Stream should be Stream<T> = () => Subscription<T>. This way, it would be analogous to AsyncIterable and AsyncIterator.
Activity