Skip to content

Get Value from a IOEither example #11

Answered by Punie
seyfer asked this question in Q&A
Discussion options

You must be logged in to vote

Hello 🙂

First, sorry for the delay, I somehow completely missed your issue 😞
I still hope you'll find the (late) answer useful.

If I understand correctly, you are trying to do the following:

pipe(
  someIOEither,
  IOEither.getOrElse(() => null),
  ...do something with the A | null from the IOEither
)

And because it doesn't work, you are going through the trouble of converting your IOEither to a TaskEither (I assume because you are more comfortable with the latter?) which makes your computation async.

The problem you are having is that IOEither<E, A> is just sugar for IO<Either<E, A>> and the getOrElse only applies to the inner Either, collapsing the whole thing into an IO<A> that you can…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by julienfouilhe
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
question Further information is requested
2 participants
Converted from issue

This discussion was converted from issue #7 on November 30, 2021 13:55.