Effect CommunityEC
Effect Community3y ago
50 replies
Rambo

How to convert an Effect to an Option ?

I know that Option is a subtype of Effect.

I wanted to use Effect.flatMap(element => Option.fromNullable(element))

But what I get is typed as an Effect.

How can I convert an effect to an option ?

I want to represent an async operation that can return null as an Option.
I want to go from this Promise<T | null> to that Option<T>.
Was this page helpful?