-
-
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
Introduce Bifunctor Laws #559
Conversation
- Create BifuncorLaws - Create BifunctorTests - Add Bifunctor instances for Validated, Ior, Xor, and XorT - Add Bifunctor tests for Validated, Ior, Xor, and XorT Fixes: 557
Current coverage is
|
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] = |
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.
Sorry, this is super nitpicky, but could you name this iorBifunctor
just to match the convention of the instances above it?
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.
Similarly for the instances in the other files.
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) |
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.
Could you also remove the parens from f
and g
? If functions have only one parameter we usually omit them.
Also LGTM. |
- Removed unnecessary parens - Renamed methods to match the convention
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). |
Merging, thanks! |
@agenovese no worries. What you had was completely fine! I'm just nitpicky :P |
Fixes: 557