how to debug which fibers are still running? (and other scope questions)
I am doing an effect system but I may have some misunderstanding about how Scope and resource management work, especially when it comes to layers. I have a script which must always exit, but sometimes even when I reach the end of my program, it still hangs. I suppose it's because some Fibers are still alive (though suspended?). I am running process.exit(0) to make sure it works, but that's not ideal, because it means I'm just hiding my resource management problem.
I have a few questions: 1. can I somehow debug how these fibers were created? 2. if I do Layer.launch to run a server, and some dependencies are Layer.scoped, since the final effect is <never,never, R>, that means that those scoped layers will never be destroyed right? 3. what does Layer.unwrapScoped does? I realize it must provide a scope to an effect which creates a layer? 4. why is it an anti-pattern that I create layers which have Scope as a requirement? (effect LSP sometimes points that out) 5. at some point I have:
. This makes the Effect.gen where I run this have a Scope requirement too, which on the caller I provide with Scope.extend(scope). If I then close this scope, will the fiber stop?