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

Function countOps

packages/effect/test/Channel.test.ts:980–992  ·  view source on GitHub ↗
(effect: Effect.Effect<A, E>)

Source from the content-addressed store, hash-verified

978
979// The scheduler is asked whether to yield once for each fiber run-loop operation.
980const countOps = <A, E>(effect: Effect.Effect<A, E>): Effect.Effect<number, E> =>
981 Effect.suspend(() => {
982 let ops = 0
983 const scheduler: Scheduler.Scheduler = {
984 executionMode: "sync",
985 makeDispatcher: () => new Scheduler.MixedScheduler("sync").makeDispatcher(),
986 shouldYield: () => {
987 ops++
988 return false
989 }
990 }
991 return Effect.map(Effect.provideService(effect, Scheduler.Scheduler, scheduler), () => ops)
992 })

Callers 1

opsFunction · 0.70

Calls 2

makeDispatcherMethod · 0.65
mapMethod · 0.45

Tested by

no test coverage detected