t3-code-android-nightly/.repos/effect-smol/migration/generators.md
Julius Marminge e3f1405884
chore: add vendored reference repo subtree sync tooling (#2902)
Co-authored-by: codex <codex@users.noreply.github.com>
2026-06-01 21:44:23 -07:00

574 B

Generators

Effect.gen: Passing this

In v3, you could pass a self value directly as the first argument to Effect.gen. In v4, self must be wrapped in an options object.

v3

import { Effect } from "effect"

class MyService {
  readonly local = 1
  compute = Effect.gen(this, function*() {
    return yield* Effect.succeed(this.local + 1)
  })
}

v4

import { Effect } from "effect"

class MyService {
  readonly local = 1
  compute = Effect.gen({ self: this }, function*() {
    return yield* Effect.succeed(this.local + 1)
  })
}