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 getOrElseF method to XorT #705

Merged
merged 1 commit into from
Dec 1, 2015
Merged

Conversation

easel
Copy link
Contributor

@easel easel commented Dec 1, 2015

No description provided.

@easel
Copy link
Contributor Author

easel commented Dec 1, 2015

@ceedubs per gitter discussion, here's a first attempt at an implementation + test for XorT.getOrElseF

@codecov-io
Copy link

Current coverage is 85.02%

Merging #705 into master will increase coverage by +0.02% as of 0549329

@@            master    #705   diff @@
======================================
  Files          162     162       
  Stmts         2228    2230     +2
  Branches        74      74       
  Methods          0       0       
======================================
+ Hit           1894    1896     +2
  Partial          0       0       
  Missed         334     334       

Review entire Coverage Diff as of 0549329

Powered by Codecov. Updated on successful CI builds.

@adelbertc
Copy link
Contributor

👍

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)
Copy link
Contributor

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...

@ceedubs
Copy link
Contributor

ceedubs commented Dec 1, 2015

👍

@easel
Copy link
Contributor Author

easel commented Dec 1, 2015

Easy enough to change. Update incoming.

@easel
Copy link
Contributor Author

easel commented Dec 1, 2015

I'm pretending I didn't read the contributing file and force pushing the change anyway. Match parameters now updated per @ceedubs suggestion.

@ceedubs
Copy link
Contributor

ceedubs commented Dec 1, 2015

Thanks!

ceedubs added a commit that referenced this pull request Dec 1, 2015
Add getOrElseF method to XorT
@ceedubs ceedubs merged commit 0fcefbf into typelevel:master Dec 1, 2015
@easel easel deleted the xort-getorelsef branch December 1, 2015 07:27
@easel
Copy link
Contributor Author

easel commented Dec 1, 2015

Cool, thanks for the help!

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 this pull request may close these issues.

4 participants