Effect CommunityEC
Effect Community3y ago
16 replies
tatemz

Converting Either to Effect for flatMapping other effects

Is there an api function for converting an Either to an Effect so I can flatMap other effects?

This doesn't work, but it gets across the idea I am loooking for
myEither.pipe(
    Either.mapBoth({
      onLeft: (e) => Effect.fail(e),
      onRight: (r) => Effect.succeed(r)
    }),
  );
Was this page helpful?