Join Slack
Powered by
I have an Either<A, B>. I want to call .map ...
# arrow
j
Jeff
05/21/2021, 6:00 PM
I have an Either<A, B>. I want to call .map to make it an <A, C> but the map may produce an A. Is there a way to do this with map or is there something else? ex;
Copy code
myEither.map { try { it.toC() } catch (e: Exception) { A() } }
Jeff
05/21/2021, 6:02 PM
ohh looks like I want flatMap and just call .right() or .left() on my C and A respectively.
👌 1
p
pakoito
05/21/2021, 7:25 PM
either.catch may be helpful too
âž• 1
3
Views
Open in Slack
Previous
Next