-
-
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 Bifoldable, fixes #94 #864
Conversation
Also: - Add MonadCombine separate - Add serializability check for Bifunctor[Xor]
Hmm Travis isn't running - closing and re-opening to see what happens. |
Current coverage is
|
There we go |
@@ -166,9 +166,19 @@ private[data] sealed abstract class XorInstances extends XorInstances1 { | |||
def combine(x: A Xor B, y: A Xor B): A Xor B = x combine y | |||
} | |||
|
|||
implicit def xorBifunctor: Bifunctor[Xor] = | |||
new Bifunctor[Xor] { | |||
implicit def xorBifunctor: Bifunctor[Xor] with Bifoldable[Xor] = |
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.
It looks like we are combining the Bifunctor
and Bifoldable
instances in some places but not others. I guess if we are going to go forward with #800 then they will eventually be combined anyway. Was there any particular reason behind when they've been combined and when they haven't?
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.
As a note there can also be |
👍 |
Thanks, @adelbertc! |
👍 @stew ? :D |
/** | ||
* A type class abstracting over types that give rise to two independent [[cats.Foldable]]s. | ||
*/ | ||
trait Bifoldable[F[_, _]] extends Serializable { self => |
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.
extends Any with Serializable
?
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.
Hmm I see why we would want to do that, but it doesn't seem like we do it in other type classes.. do we?
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.
Simulacrum does it automatically. We probably aren't consistent with the F[_,_]
type classes though.
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.
Alright I added it for Bifoldable
, I've added an issue to do it for the others and I'll probably end up doing it in a future PR unless someone beats me to it
👍 I didn't see syntax for |
4a18cce
to
a394388
Compare
Added some more stuff per @mpilquist 's comments - @ceedubs re-review? :D |
👍 Out of curiosity, is the reason we want to extend I could potentially see some value in providing methods to extract a |
I'll give @mpilquist another chance to review since there were some changes since his last 👍 |
👍 |
I based myself on the structure in syntax.bitraverse for the two implicit conversions (the existing for unite and the new for separate). MonadCombine separate was added in typelevel#864 by @adelbertc.
Also: