Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EitherT.pure does not call F.pure on the 'Right' value #3398

Closed
aherrmann13 opened this issue Apr 19, 2020 · 1 comment · Fixed by #3408
Closed

EitherT.pure does not call F.pure on the 'Right' value #3398

aherrmann13 opened this issue Apr 19, 2020 · 1 comment · Fixed by #3408

Comments

@aherrmann13
Copy link

aherrmann13 commented Apr 19, 2020

EitherT.pure (and EitherT.rightT) does not have the same behavior as EitherT.leftT

EitherT.rightTcalls EitherT.pure, which calls right(F.pure(b)), which results in EitherT(F.map(F.pure(b))(Right(_)))

EitherT.leftT calls EitherT(F.pure(Left(a)))

when using IO the execution of converting F[B] => F[Either[A, B]] is delayed until IO is run on EitherT.pure and EitherT.rightT and it is not delayed on EitherT.leftT

Is there a reason for having pure as an alias for rightT, and evaluating F.pure(a) and then converting it to a Right value with map instead of using EitherT(F.pure(Right(b)))?

@aherrmann13 aherrmann13 changed the title EitherT.pure does not immediately resolve the value EitherT.pure does not call F.pure on the 'Right' value Apr 19, 2020
@joroKr21
Copy link
Member

joroKr21 commented May 7, 2020

I think we should use the more performant version 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants