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

Introduce Bifunctor Laws #559

Merged
merged 2 commits into from
Oct 4, 2015
Merged

Introduce Bifunctor Laws #559

merged 2 commits into from
Oct 4, 2015

Conversation

agenovese
Copy link

  • Create BifuncorLaws
  • Create BifunctorTests
  • Add Bifunctor instances for Validated, Ior, Xor, and XorT
  • Add Bifunctor tests for Validated, Ior, Xor, and XorT

Fixes: 557

- Create BifuncorLaws
- Create BifunctorTests
- Add Bifunctor instances for Validated, Ior, Xor, and XorT
- Add Bifunctor tests for Validated, Ior, Xor, and XorT

Fixes: 557
@codecov-io
Copy link

Current coverage is 75.89%

Merging #559 into master will increase coverage by +0.41% as of 56da30a

@@            master    #559   diff @@
======================================
  Files          153     156     +3
  Stmts         2064    2112    +48
  Branches        68      68       
  Methods          0       0       
======================================
+ Hit           1558    1603    +45
  Partial          0       0       
- Missed         506     509     +3

Review entire Coverage Diff as of 56da30a

Powered by Codecov. Updated on successful CI builds.

@non
Copy link
Contributor

non commented Oct 4, 2015

Thanks! This looks good to me.

👍

@@ -142,6 +144,11 @@ sealed abstract class IorInstances extends IorInstances0 {
def pure[B](b: B): A Ior B = Ior.right(b)
def flatMap[B, C](fa: A Ior B)(f: B => A Ior C): A Ior C = fa.flatMap(f)
}

implicit def bifunctor: Bifunctor[Ior] =
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, this is super nitpicky, but could you name this iorBifunctor just to match the convention of the instances above it?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similarly for the instances in the other files.

@ceedubs
Copy link
Contributor

ceedubs commented Oct 4, 2015

Other than my super nitpicky comment, this looks good. 👍


implicit def bifunctor: Bifunctor[Ior] =
new Bifunctor[Ior] {
override def bimap[A, B, C, D](fab: A Ior B)(f: (A) => C, g: (B) => D): C Ior D = fab.bimap(f, g)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you also remove the parens from f and g? If functions have only one parameter we usually omit them.

@fthomas
Copy link
Member

fthomas commented Oct 4, 2015

Also LGTM.

- Removed unnecessary  parens
- Renamed methods to match the convention
@agenovese
Copy link
Author

Fixed, and sorry about those. I should have noticed the naming and I never use parens like that (going to blame the IDE and the fact that it was after 2am).

@fthomas
Copy link
Member

fthomas commented Oct 4, 2015

Merging, thanks!

fthomas added a commit that referenced this pull request Oct 4, 2015
@fthomas fthomas merged commit 3565ed4 into typelevel:master Oct 4, 2015
@agenovese agenovese deleted the Issue557 branch October 4, 2015 15:52
@ceedubs
Copy link
Contributor

ceedubs commented Oct 5, 2015

@agenovese no worries. What you had was completely fine! I'm just nitpicky :P

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.

6 participants