EffectTalk

Effect.scoped for bracket-style cleanup

Effect.scoped creates a scope for resources. Any resource acquired with acquireRelease (or Layer.scoped) is released when the scope ends.

You must wrap the program in Effect.scoped when it uses scoped resources.

  • Use Effect.scoped(program) when the program uses scoped resources
  • The scope ensures all acquired resources are released
  • Order of release is LIFO (last acquired, first released)
Loading code editor...