Creating Streams from Effects in Effect Typescript Without Excessive Verbosity

So my understanding is that, working on top of streams - like creating streams from streams, you can map the stream, but that's only clean if you don't need to do effects beforehand. what's the best way to do it if you can't map because you need to retrieve data... something like this:

function createMyStream() {
  return Stream.async(emit => {
    const stuff = // ... some effects, maybe fetch or something
    Stream.map(someOtherStreamFromStuff(stuff), val => emit(val))
  })
}


This is a concise pseudo-code type thing but in practice when I do this it looks incredibly verbose, and I don't know a nice way to handle the output from the stuff effects into the emit function

Especially when using generators and whatnot when the stuff effects get complex.

Being able to capture the errors from stuff and put them in emit is important, and I feel like my solutions are hacky workarounds
Was this page helpful?