Effect CommunityEC
Effect Community3y ago
5 replies
dp

Effect Community's View on Destructuring Effect Functions

Does the Effect community frown on destructuring the Effect functions into standalone functions?

I.e. from this:
import { Effect } from "effect";

const divide = (a: number, b: number): Effect.Effect<never, Error, number> =>
  b === 0
    ? Effect.fail(new Error("Cannot divide by zero"))
    : Effect.succeed(a / b);


to this:
import { Effect } from "effect";
const { fail, succeed } = Effect;

const divide = (a: number, b: number): Effect.Effect<never, Error, number> =>
  b === 0 ? fail(new Error("Cannot divide by zero")) : succeed(a / b);


Any reason to avoid this?
Was this page helpful?