MCPcopy Index your code
hub / github.com/Effect-TS/effect / gen

Function gen

packages/effect/src/Either.ts:784–798  ·  view source on GitHub ↗
(...args)

Source from the content-addressed store, hash-verified

782 * @since 2.0.0
783 */
784export const gen: Gen.Gen<EitherTypeLambda, Gen.Adapter<EitherTypeLambda>> = (...args) => {
785 const f = args.length === 1 ? args[0] : args[1].bind(args[0])
786 const iterator = f(adapter)
787 let state: IteratorResult<any> = iterator.next()
788 while (!state.done) {
789 const current = Gen.isGenKind(state.value)
790 ? state.value.value
791 : Gen.yieldWrapGet(state.value)
792 if (isLeft(current)) {
793 return current
794 }
795 state = iterator.next(current.right as never)
796 }
797 return right(state.value) as any
798}
799
800// -------------------------------------------------------------------------------------
801// do notation

Callers

nothing calls this directly

Calls 4

fFunction · 0.70
nextMethod · 0.65
isLeftFunction · 0.50
rightFunction · 0.50

Tested by

no test coverage detected