import { NodeRuntime } from "@effect/platform-node"
import { Effect, Fiber, FiberRef, pipe } from "effect"
const log = Effect.gen(function*() {
const v = yield* FiberRef.get(FiberRef.currentConcurrency);
yield* Effect.log(v);
})
const program = Effect.gen(function*() {
yield* log
const fiber = yield* pipe(
log,
Effect.andThen(FiberRef.set(FiberRef.currentConcurrency, 2)),
Effect.andThen(log),
Effect.fork,
)
yield* Fiber.join(fiber);
yield* log
})
program.pipe(
NodeRuntime.runMain
)
import { NodeRuntime } from "@effect/platform-node"
import { Effect, Fiber, FiberRef, pipe } from "effect"
const log = Effect.gen(function*() {
const v = yield* FiberRef.get(FiberRef.currentConcurrency);
yield* Effect.log(v);
})
const program = Effect.gen(function*() {
yield* log
const fiber = yield* pipe(
log,
Effect.andThen(FiberRef.set(FiberRef.currentConcurrency, 2)),
Effect.andThen(log),
Effect.fork,
)
yield* Fiber.join(fiber);
yield* log
})
program.pipe(
NodeRuntime.runMain
)