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

Add biFlatMap to EitherT #2438

Closed
ochrons opened this issue Aug 23, 2018 · 1 comment
Closed

Add biFlatMap to EitherT #2438

ochrons opened this issue Aug 23, 2018 · 1 comment

Comments

@ochrons
Copy link
Contributor

ochrons commented Aug 23, 2018

EitherT has a bimap but no biFlatMap. This would be useful when chaining computations and needing to process both sides of the Either with functions that return an EitherT. For example:

def findVertex(id: String): EitherT[Future, APIError, Vertex]
def addVertex(...): EitherT[Future, APIError, String]
def doSomethingWithVertex(...): EitherT[Future, APIError, String]

findVertex("id").biFlatMap( {
  case _: APIError.NotFound => addNewVertex(...)
  case error => EitherT.left(error)
},
vertex => doSomethingWithVertex(vertex)
)
@agajek
Copy link
Contributor

agajek commented Oct 6, 2018

I can take this one.

LukaJCB pushed a commit that referenced this issue Oct 23, 2018
* Add biFlatMap to EitherT

Fixed #2438

* Add biFlatMap to EitherT

Relaxed constraint of the Monad to FlatMap in biFlatMap
Fixes #2438
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

No branches or pull requests

2 participants