Implementing the 'traverse' Concept with Options in fp-ts

Hi! In fp-ts, there was the concept of traverse that was particularly handy with options. You could, with one function, apply an effect to the value inside the option and "reverse" the option and effect.
I found that we can achieve the same with:
declare const foo: Option<number>;
declare const divide: (
  number: number,
) => (by: number) => Effect.Effect<never, string, never>;

const bar1: Effect.Effect<Option.Option<number>, string, never> = pipe(
  foo,
  Effect.flatMap(divide(3)),
  Effect.optionFromOptional,
);

It's a pretty common pattern in our codebase and it would be great to have a combinator to do this in only one step. It would be "leaner" but it would also make it more explicit, in my opinion.
Anything I've missed in the api? Would you consider adding it? I could try to contribute to the repo if yes.
Thanks for your answers!
Was this page helpful?