MCPcopy Create free account
hub / github.com/Effect-TS/effect / gen

Function gen

packages/effect/src/Micro.ts:1223–1231  ·  view source on GitHub ↗
(
  ...args:
    | [self: Self, body: (this: Self) => Generator<Eff, AEff, never>]
    | [body: () => Generator<Eff, AEff, never>]
)

Source from the content-addressed store, hash-verified

1221 * @category constructors
1222 */
1223export const gen = <Self, Eff extends YieldWrap<Micro<any, any, any>>, AEff>(
1224 ...args:
1225 | [self: Self, body: (this: Self) => Generator<Eff, AEff, never>]
1226 | [body: () => Generator<Eff, AEff, never>]
1227): Micro<
1228 AEff,
1229 [Eff] extends [never] ? never : [Eff] extends [YieldWrap<Micro<infer _A, infer E, infer _R>>] ? E : never,
1230 [Eff] extends [never] ? never : [Eff] extends [YieldWrap<Micro<infer _A, infer _E, infer R>>] ? R : never
1231> => suspend(() => fromIterator(args.length === 1 ? args[0]() : args[1].call(args[0]) as any))
1232
1233const fromIterator: (
1234 iterator: Iterator<any, YieldWrap<Micro<any, any, any>>>

Callers 1

diffLawsFunction · 0.50

Calls 2

fromIteratorFunction · 0.85
suspendFunction · 0.70

Tested by 1

diffLawsFunction · 0.40