-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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 getOrElseF method to XorT #705
Conversation
@ceedubs per gitter discussion, here's a first attempt at an implementation + test for XorT.getOrElseF |
Current coverage is
|
👍 |
def getOrElseF[BB >: B](default: => F[BB])(implicit F: Monad[F]): F[BB] = { | ||
F.flatMap(value) { | ||
case Xor.Left(a) => default | ||
case Xor.Right(a) => F.pure(a) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extremely minor: I'd be inclined to use the following names for the captured values:
case Xor.Left(_) => default
case Xor.Right(b) => F.pure(b)
As this doesn't actually result in any difference, I'm not sure I can really justify the nitpick though...
👍 |
Easy enough to change. Update incoming. |
793b3e7
to
ec534f6
Compare
I'm pretending I didn't read the contributing file and force pushing the change anyway. Match parameters now updated per @ceedubs suggestion. |
Thanks! |
Cool, thanks for the help! |
No description provided.