Using Effect in Temporal Workflow Code: Determinism Concerns and Edge Cases

Can I use effect in temporal workflow code given the constraints around determinism? I know that we can use effect in temporal activities without issue, and i've been playing around with effect in workflow code directly and it seems to work? Just worried about the determinism edge cases.

import { proxyActivities } from "@temporalio/workflow";
import type * as activities from "./activities.ts";
import { Effect } from "effect";

const { greet } = proxyActivities<typeof activities>({
  startToCloseTimeout: "1 minute",
});

export async function helloWorldWorkflow(name: string): Promise<string> {
  console.log(`Workflow: Starting hello world workflow for ${name}`);

  await Effect.runPromise(Effect.gen(function* () {
    yield* Effect.sleep("5 seconds");
  }));

  const greeting = await greet(name);
  console.log(`Workflow: Received greeting: ${greeting}`);
  return greeting;
}
Was this page helpful?