Exploring Effects and Struggling with Streams: A Journey from rxjs to fp-ts
Hey, I'm currently looking into effects, which looks really awesome. I'm coming from rxjs and dabbled a bit with fp-ts. I guess wrapping promises is the easier part, but now I'm trying to grasp Streams (in combination with Scopes, making it extra hard, which both are not yet documented, which is probably why I'm struggling).
1. Now I'm struggeling to understand how trigger the finalizer. Could someone provide an example for subscribing to an endless stream and unsubscribing after some elements or a condition is met? 2. My understanding of Streams is currently, that I can runDrain, which would produce a fiber (like a subscription in rxjs) and I should be able to interrupt the fiber (like unsubscribe in rxjs?). Is this assumption correct? 3. In rxjs the take operator will unsubscribe from the source observable automatically, which I'm not seeing in Effect, do they behave differently? (Could be of course that my finalizer is not set up correctly)
// subscribe will get the first event, but then the finalizer of watcher will be calledwatcher('src').pipe(take(1)).subscribe(console.log)
// subscribe will get the first event, but then the finalizer of watcher will be calledwatcher('src').pipe(take(1)).subscribe(console.log)
Thank you for all the hard work you are putting into this project