Efficient way of generating 'x' amount of effects into a primitive array

is there a more efficient or succinct way of generating 'x' amount of effects into a primitive array? im sure im going about this the wrong way...

const program = Effect.gen(function* (_) {
  const service = yield* UuidProvider;
  return yield* service.generate;
}).pipe(Effect.provide(UuidProviderLive));

describe("uuid-provider", () => {
  it("generates unique uuid's", () => {
    const length = 100;
    const values = pipe(
      Array.makeBy(length, () => program),
      Effect.all,
      Effect.map(Array.dedupe),
      Effect.runSync,
    );

    expect(values.length).toEqual(length);
  });
});
Was this page helpful?