Effect CommunityEC
Effect Community16mo ago
2 replies
Oung Seik

How to sequence/traverse `Effect<Option<Effect>>`

const program = FindableUser.findOne({ email }).pipe(
  Effect.map(Option.map((user) => validatePassword(password, user.password)))
);

In my code the findOne return Effect<Option<User>> and the validatePassword return Effect<boolean> which result the type of
Effect.Effect<Option.Option<Effect.Effect<boolean, never, never>>, MongoError, never>. I want to swap the inner Option<Effect> to Effect<Option> in order to flat with the outer one. Is this possible? If it possible, how to do this?
Was this page helpful?