Streams and Effect.gen

Hello everyone! I started playing with effect, trying to wrap my head around refactoring a small rxjs application that nobody is able to maintain but me, and I would like to change that šŸ˜…

Is there a story between Effect.gen and Stream? I would like consume a stream from some imperative logic that then emits a stream again. In my head this looks something like this (which obviously does not work):

Effect.gen(function* () {
  const directories = ['a', 'b', 'c'];
  for(const dir of directories) {
    const stream = yield* scanIntoStream(dir);
    for(const file of stream) {
      yield doSomething(file);
    } 
  }
});


I know how to model it purely with Streams/Observables, but I’m wondering if generators allow to do it imperatively as well.
Was this page helpful?