Question about Effect.scoped necessity in a Fiber example

Hi everyone, just going through the documentation as a newcomer to understand things a little bit and I have the following issue, in the Guides > Concurrency > Fibers: forkIn specific scope we have the following code to show how a Fiber can be tied to a user manager scope:

import { Effect, Console, Schedule } from "effect"
 
const barJob = Effect.repeat(
  Console.log("Still running!"),
  Schedule.fixed("1 second")
)
 
const program = Effect.scoped(
  Effect.gen(function* () {
    const scope = yield* Effect.scope
    yield* Effect.scoped(
      Effect.gen(function* () {
        yield* Effect.forkIn(barJob, scope)
        yield* Effect.sleep("3 seconds")
        console.log("The innermost scope is about to be closed.")
      })
    )
    yield* Effect.sleep("5 seconds")
    console.log("The outer scope is about to be closed.")
  })
)
 
Effect.runPromise(program)


What I'm trying to know is if there is any difference with this program, and one where the Effect.scoped of the inner Effect.gen is removed, is it really needed ?
Was this page helpful?